Jarrod Evans showed nerves of steel to boot Cardiff to victory after a Theo Cabango brace inspired a rousing comeback in the United Rugby Championship.
An early Jason Harries try gave Cardiff the perfect start following three disappointing defeats on the road but they soon found themselves staring down the barrel at 21-8.
With three tries Glasgow were in a commanding position but Cabango snatched an opportunist try to keep Cardiff in the fight.
An interception try from Sebastian Cancelliere early in the second-half could have been a knockout blow for Dai Young’s men but they refused to throw in the towel with tries from Willis Halaholo and a second from Cabango sending the Arms Park into wild celebrations.
The win gives Cardiff momentum ahead of next week's trip to Llanelli, where they take on Scarlets in the first of back-to-back derby encounters.
Back at the Arms Park for the first time in two months, the Blue and Blacks made a promising start to the encounter with Willis Halaholo making his good yards and Theo Cabango threatening down the left.
Cardiff dominated the opening exchanges and following a sustained period of pressure Jason Harries powered through Cole Forbes and had the strength to ride another tackle and stretch over in the corner.
Evans’ touchline conversion dropped marginally short of the right post but he soon made it 8-0 with a well-struck penalty after some good work from Lloyd Williams.
Glasgow soon responded with a fine try from deep on the counter attack. Kyle Steyn ran from well inside his half and then released Argentine Sebastian Cancelliere on the outside. The wing tore down the right before stepping inside Jason Harries who rushed across on the cover.
Ross Thompson converted from in front and Glasgow continued to cause Cardiff problems out wide, while the home line out also miss-fired to make matters worse.
The Scots claimed a second soft try on 25 minutes as Sam Johnson stepped inside the home defence from close range, with Thompson again on target.
Danny Wilson’s side continued to take a stranglehold on affairs and they dealt a further blow on Cardiff as they kicked a succession of penalties to the corner and demonstrated plenty of patience and organisation to rumble over.
Fraser Brown was the beneficiary at the back of the maul and Thompson added a third conversion to stretch his side’s lead to 21-8.
It was beginning to appear ominous for the hosts but they dragged themselves back into the encounter with a try from their next attack.
They went through plenty of phases again in the build up and attempted to use Harries as a battering ram. He took on two defenders as the ball was knocked out of his grasps but fortunately it went backwards and Cabango was the quickest to react as he danced over.
Evans converted to cut the deficit to six points with five minutes of the half remaining. Glasgow had one final chance after two ricochets from a kick through saw the ball trickle towards the whitewash and James Botham saved the day.
Glasgow were given the scrum and then awarded a penalty but after kicking to the corner Brown’s throw went astray and Cardiff were handed a reprieve as it remained 15-21.
As the second-half got underway, Cardiff showed no hesitation to attack and they soon created on the left. They had the numbers and it appeared to be a try-scoring opportunity but Cancelliere gambled and intercepted Ben Thomas’ pass to race clear.
Thompson kept the scoreboard ticking as he nudged the visitors further out of sight following the devastating blow.
Moments later, the Argentina wing attempted another intercept after a simply outrageous Halaholo break, which saw the centre beat countless Scottish defenders. The ball was moved to the left and Cancelliere knocked on as he gambled once more and play petered out.
He was subsequently sent to the sin-bin and frustrated Cardiff continued to battle in vein with Botham soon held up over the line.
However, as the hour mark approached Hallam Amos, Harries and Lloyd Williams combined o n the counter to unlock the Glasgow defence. Possession was maintained and Cardiff turned the screw before a beautifully delayed pass from Ben Thomas gave Halaholo half a chance and he ghosted through.
Evans added the touchline conversion and Cardiff were well and truly back in the game with home crowd too now playing their part.
Cardiff tried and tried to manufacture a scoring moment and the infringements began to pile up against the visitors.
And eventually, with the clock ticking into the final ten minutes it came as Evans double, triple pumped to give Cabango a second sniff and he had enough pace to dart over with the help of a goose-step.
Evans showed nerves of steel to slot the conversion, but this wasn't a time for the hosts to sit back and consolidate their lead. They continued to show promise in attack, forcing Glasgow to defend deep in their 22 for the majority of the final 10.
A Cancelliere interception saved their skin when a Cabango hat-trick looked inevitable, but the pressure was taking it's toll, forcing the visitors to concede a series of penalites.
Evans' 12th point of the evening opened up a four-point gap with a minute remaining, and Young's men had the composure to see the game out and secure a crucial and momentous victory ahead of next week's derby clash in Llanelli.