Emerson Hyndman salvaged a gritty and dramatic victory for Rangers with a stoppage time goal which arrested their recent slump and rekindled hopes of the runners-up spot in the Premiership this season.
The on-loan Bournemouth midfielder struck to give caretaker manager Graeme Murty his first league win after St Johnstone had wiped out a 2-0 deficit in a tumultuous second half which saw Rangers defender Rob Kiernan sent off.
It was another flawed display from Rangers in many ways but it lacked nothing in spirit or resilience, qualities which eventually saw them over the line to close the gap on second-placed Aberdeen to six points.
Barrie McKay has often proved capable of rising above the general malaise which has stunted Rangers’ progress this season and the young winger was certainly the most eye-catching performer on this occasion as the hosts looked to avoid sustaining a third consecutive league defeat for the first time since 2000.
He was prominent in most of Rangers’ best moments in a first half when they merited the lead provided by his 22nd- minute strike.
Saints were looking to respond to what manager Tommy Wright described as one of the worst displays of his tenure, Saturday’s 2-0 home defeat to Kilmarnock, but they found themselves under early pressure.
Just three minutes were on the clock when Martyn Waghorn’s shot was blocked and Hyndman seized on the loose ball to fire narrowly wide.
If Hyndman has impressed since joining the club in January, the same cannot be said of his fellow loanee Jon Toral. The Arsenal man again looked hesitant and off the pace, gifting Saints their first sight of goal with an unfathomably poor pass straight into the path of Steven MacLean. Fortunately for Toral, the Saints striker shot wide from a good position.
Toral had the opportunity to make amends at the other end of the pitch but headed wide of the target after being picked out by a James Tavernier free-kick. As Rangers gathered attacking momentum, Hyndman came close again when his snapshot from the edge of the penalty area drifted just beyond Zander Clark’s left-hand post.
Rangers were rewarded for their purposeful approach when McKay made the breakthrough. Hyndman was the catalyst with a fine driving run which took him into the heart of the visitors’ penalty area. He was eventually crowded out but Lee Wallace managed to make contact with the loose ball which sent it into McKay’s path. From around 18 yards, he guided a precise right-foot shot beyond Clark into the corner of the net.
Rangers were almost caught cold immediately after the goal when Blair Alston was afforded plenty of time and space before shooting wide. There remained a sense of vulnerability about the home defence whenever Saints engineered a decent attacking situation. Richard Foster was unable to take advantage of one of them, heading tamely at Wes Foderingham from close range.
It required a couple of fine saves from Clark at the other end to prevent Rangers increasing their advantage before the break. He reacted smartly to keep out a low drive from Waghorn, then leapt high to his right to touch over a 25-yard shot from Jason Holt.
Saints should have been back on level terms two minutes into the second half when the Rangers defence were badly exposed as Keith Watson was able to raid down the right and pick out the unmarked Liam Craig with his cross. With the goal gaping, however, Craig contrived to head wide from around four yards.
That proved a costly miss as Rangers made it 2-0 just a minute later. Kenny Miller found a good position wide on the right and his cross was nodded firmly beyond Clark from close range by Waghorn.
Joe Garner was introduced for Miller and the substitute should have put Rangers out of sight in the 66th minute but could only stab his close range shot against a post after good work from Hyndman had created the chance.
David Wotherspoon, sent on for the unusually subdued Danny Swanson, made a more telling contribution for Saints when he pulled them back into contention with his 74th-minute goal, smashing a right foot shot beyond Foderingham from Craig’s cross.
Rangers’ anxieties deepened two minutes later with the dismissal of Kiernan for a reckless and needless challenge on Graham Cummins. The hosts attempted to stay on the front foot regardless and Garner came close again when he curled a shot narrowly wide.
But Saints made the most of their extra man when they levelled three minutes from time. Craig’s corner from the right found its way to the unmarked Andersonm, who drove home a right-foot shot from around 14 yards.
It looked as if Wright’s men would maintain their unbeaten record against Rangers this season but they were undone by the excellent Hyndman. Having already struck the crossbar in immediate response to Saints’ equaliser, the American grabbed the stoppage-time winner when he latched onto a Clint Hill knockdown and drilled a low shot beyond Clark’s right hand.