Rangers' league resurgence came to an abrupt end as Caolan Boyd-Munce's stoppage-time strike gave St Mirren a 2-1 win to leave the Light Blues 12 points behind William Hill Premiership leaders Celtic.
After a poor start to the league season Philippe Clement had got his side firing, but they were well off the pace in the first half in Paisley and trailed at the break to an Oisin Smyth penalty on the half-hour mark.
With the introduction of midfielder Nico Raskin and Brazilian striker Danilo at the start of the second half, the Light Blues began to play with conviction and the latter levelled in the 61st minute, but the home side steadied and substitute Boyd-Munce drove in a dramatic winner in added time.
Another Rangers negative was defender Leon Balogun going off early in the first half after pulling up and, with John Souttar also sidelined, it could leave Clement short of centre-back options ahead of games against Motherwell and Celtic in the next week.
It was a signature win for the Buddies, who revealed before the game that former Gers defender Declan John had extended his contract with the club until the end of the season.
John made his first start for Saints, while striker Toyosi Olusanya returned from suspension, with Alex Gogic was reinstated to the defence.
Jack Butland returned in goal for Rangers after dropping out minutes before the win over Dundee at the weekend to rush to the birth of his daughter - and he was culpable for the home side's penalty.
Balogun, holding midfielder Connor Barron and attacker Nedim Bajrami returned to an in-form Gers side who had to look back to October for their last defeat in 90 minutes.
The early stages were all hustle and bustle before Balogun pulled up with an injury.
The first real goalmouth action of note, however, came when Butland raced out needlessly and unconvincingly to barge Greg Kiltie to the ground as the Saints player went to take control of a long ball.
Referee David Dickinson immediately pointed to the spot and Smyth, who scored a late free-kick winner against Ross County on Saturday, sent the keeper the wrong way with an accomplished penalty.
Clement and Vaclav Cerny were booked by Dickinson soon afterwards for complaining too long about St Mirren's Marcus Fraser blocking off Hamza Igamane's run to no punishment.
Saints keeper Ellery Balcombe did not have a save to make until he gathered a tame shot by the Moroccan striker just before the break.
Clement had to take action and he brought on Raskin and Danilo for Barron and Bajrami and there was instant improvement.
Skipper James Tavernier came close with a free-kick from 25 yards and then Balcombe saved a shot from Danilo before Cerny crashed a right-footed drive against an upright.
But after making a goal-line save from Danilo, the Paisley keeper was eventually beaten from close range by the Gers substitute as the St Mirren goal continued under siege.
Igamane blasted a shot over after combining with Cerny, who then powered in a drive from distance which just cleared the bar.
At the other end Saints substitute Alex Iacovitti and Robin Propper jumped at a corner and the ball rebounded off the near post.
The game swung from end to end.
A mistake by Propper allowed Olusanya to race clear, but Raskin got back to see off the danger.
Among the usual plethora of substitutes, 17-year-olds Callum Penman and Evan Mooney replaced John and Olusanya, but it was another replacement, Boyd-Munce, who proved the match-winner in the third of six added minutes.
He met a Mooney pass and drilled a shot low past Butland from 20 yards to sink the Gers.