Two penalties from scrum half Colin Gregor, after 69 and 73 minutes, had whittled Edinburgh's lead down to four points and ultimately it was enough for Glasgow to secure the silverware for another year.
However, they will be disappointed to have lost to their arch rivals for the first time in five games. Thompson's late intercept try, which was converted by David Blair, copperfastened the points for Edinburgh and keeps them two places above Glasgow in the Magners League standings.
In moving back into seventh place, Rob Moffat's side are now seven points clear of the Warriors, who have a game in hand and travel to table-toppers Munster next weekend.
Two cracking tries from Netani Talei and man-of-the-match Tim Visser set Edinburgh on the way to their first victory over Glasgow since December 2008. Fly-half Blair did a good amount of damage too, kicking 13 points.
Half-backs Ruaridh Jackson and Gregor landed two penalties apiece for the title holders, whose only try was a memorable first half score from Robert Harley.
Speaking afterwards, Glasgow coach Sean Lineen said: "I'm really disappointed. A couple of guys did not front up today. Not enough of our players played well enough and Edinburgh deserved to win."
Giving his reaction, Edinburgh boss Rob Moffat admitted: "I'm pleased with the win, although we looked a bit nervous at times. We still have a lot to play for this season and hopefully we can kick on now."
Glasgow made the better start, dominating the opening stages that produced two early penalties driven home from distance by Jackson.
However, the second 10 minutes of the game yielded two stunning tries from the home side that propelled them into a 12-6 lead by the 20-minute mark.
The Dutch danger man, Visser, had a hand in both of them. The first stemmed from a lineout with Visser coming off his wing to carve open the Glasgow defence before putting number 8 Talei under the posts for Blair to convert.
Seven minutes later, the rampaging Talei attacked off a scrum in his own half and the flowing move ended with Visser, who had never previously scored against Glasgow, touching down for his ninth try in 11 league games this season.
Blair was off target with the conversion on this occasion, but the hosts had certainly got the attendance of 9,292 fired up.
Glasgow had the better of proceedings before half-time, clawing back five points courtesy of a fine touchdown by flanker Harley, who finished a move involving number 8 Richie Vernon and centre Max Evans.
Harley was hungry for work as ever, and profited from two lovely offloads from Vernon and Evans. But Jackson failed to add the conversion and also missed the target from two penalties.
His opposite number Blair was able to boot Edinburgh into a 15-11 half-time lead, albeit with their lock Craig Hamilton in the sin-bin for repeated infringements.
Glasgow also ended a high qualify opening period down to 14 men, as flanker John Barclay saw yellow for his involvement in a couple of touchline skirmishes.
The game continued to zip along as the second half got underway. Glasgow struggled to keep their discipline and Blair converted two of his three penalty attempts, in and around the hour mark, to pull his side clear at 21-11.
A scrappy and tense final quarter ensued, with Glasgow beginning to enjoy more possession and territory. After being camped near the hosts' try-line, the Warriors had to settle for a penalty, which Gregor comfortably converted. He cut the gap to four points, shortly afterwards.
But Thompson guaranteed four precious league points for the capital side when breaking clear in injury-time after an interception inside his own half.
|Edinburgh Rugby Score Card|
|Glasgow Warriors Score Card|