Second half goals from substitute Steven Thompson and Derek Lilley saw Dundee United take a giant step towards avoiding relegation.
And they also gave Celtic a definite date to plan a party as the Scottish Premier League title can now be won next week.
Martin O'Neill's team play three times before Rangers take to the field again and three wins will mean Saturday's visit of St Mirren will settle it once and for all.
Rangers had more chances in this game but were caught twice by Alex Smith's adventurous side, who have completely transformed for the better since they were last at Ibrox.
The bets have long been off as far as the title race is concerned but United look safe money now to remain in the top flight.
Rangers' next game is at Hibernian, who can put them under pressure once more for a Champions League qualifying spot if they beat St Johnstone.
Despite all that was at stake for both sides, it took the game more than half an hour to get going.
And it was the side at the wrong end of the table that almost took the lead with a move that underlined why they are no longer the SPL's whipping boys.
Lilley made ground down the right wing and fired over a cross to Charlie Miller, who had stolen in unmarked at the far post.
The former Ranger was making his first Ibrox return since Dick Advocaat sold him to Watford last season.
Miller, who is being touted in many parts for a Scotland call-up, did everything right by directing his header downwards but Stefan Klos is having the season of his life at the moment, even if his colleagues are not.
Rangers' reply was instant and the rest of the half saw United soak up more pressure.
Paul Gallacher, the Under-21 cap, may still be a novice compared to Klos but his tip over from Marcus Gayle's fierce shot, after a Jorg Albertz corner had caused anxious moments in the away defence, was top class.
Advocaat is famed for his unpredictable team selections and this game was no exception, with Rod Wallace included and Billy Dodds banished to the bench despite his three goals for Scotland since Rangers last played.
Wallace should have done better with his first chance - a glanced header wide after Tore Andre Flo had popped up on the left wing to put in the perfect cross.
Miller's header was not the only time United went close before the break as the midfielder had already forced Klos into a tip-over, albeit via a hefty upwards deflection off Scott Wilson's head.
Paul Robinson, making his first start since joining on loan from Wimbledon, also saw a shot deflected away by Wilson.
United had been forced to swap Jim Hamilton for Thompson in the first half after the striker came off worse in a clash of heads but the second change of the match was unusual.
Referee Willie Young did not reappear and his replacement, the fourth official Craig Thomson, soon had a difficult decision to make.
Wallace was away on a lightning quick counter attack following a United corner and was goalside of last man Jamie Buchan when he tumbled to the turf.
Play on was the verdict.
Wallace saw a header hit the top of the bar and bounce over before Tugay tested Gallacher with a fierce shot.
But United were bold and twice Thompson sent in teasing crosses from the left. The second was not near a colleague but the first fell to Miller and it needed Vidmar to block.
Ferguson, who had played despite the rib injury that kept him out of the midweek Scotland game, had taken a buffeting in midfield and Fabrice Fernandes, the hero of Fir Park, replaced him on the hour.
The Frenchman had made his first home appearance hard for himself though by scoring 60 seconds inside his debut that day, with only his fourth touch as a Ranger.
But Ibrox duly erupted, in appreciation rather than joy, when he unleashed a guided missile of a long ranger towards goal.
At Motherwell it had ended up in the net but this time it smacked against the crossbar and bounced away to safety.
United realised they still had a great chance of a shock and duly took the lead.
Jamie Buchan fed Robinson and his cross from the left picked out Thompson, who glanced an exquisite header past the exposed Klos.
Danny Griffin forced Klos into a diving save from a free-kick but then Lilley clinched it with a stunning finish after he had beaten the ponderous Bert Konterman to a challenge that the defender, the last man, should have won.
Just as he did at Tannadice earlier in the season, the former Morton man shot as soon as he was able - and hit the target once more.