Suber sub James Eddie emerged as the Warriors hero as they pulled off a smash and grab act.
It was nothing short of a mugging as he plunged over for the last-minute try that set up the clinching conversion for Stuart Hogg.
Ulster had dominated for the bulk of the game but the Glasgow defence kept knocking them back and their efforts were rewarded in dramatic style.
The visitors had the better of the jittery opening exchanges and they edged in front with a penalty by Stuart Hogg.
His effort was soon snuffed out by two from Paddy Jackson, who was then handed another opportunity midway through the half when Ed Kalman made no effort to vacate the tackle scene.
Again his strike was straight and true as he opened up a six-point gap.
Dan van der Merwe went within a fingertip of grabbing a great try for Glasgow.
The Canadian winger dashed after a clever chip from Ruaridh Jackson but the ball bounced unkindly and, instead of controlling it a metre from the line, he crashed head first into the base of the post.
Within two minutes Hogg was back in the spotlight to fire over another penalty, only for Paddy Jackson to restore the Ulster cushion.
The hosts stepped up the pace after the restart and the Warriors defence was tested to the full as they were pinned back in their own 22.
Glasgow’s defence were under constant pressure again going into the decisive phase of the contest and they had a reprieve when Paddy Jackson missed his next penalty.
But they were reduced to 14 men as Moray Low was yellow carded for a blatant and needless obstruction.
Despite their handicap, the Warriors produced their best attacking play of the match.
When Eddie ploughed over, the focus was on Hogg and he made no mistake.
Coach Gregor Townsend said: “The guys worked so hard for that result. This is a squad that doesn’t know when to give up.”