The Ibrox club had withstood a second half battering by their Pittodrie hosts – who extended their hot streak at home to 10 games in midweek with a win over Inverness Caledonian Thistle.
But Wes Foderingham produced a series of exceptional saves and a Kenny Miller double and a Joe Dodoo strike secured a stunning and unexpected victory.
Loading article content
The 3-0 triumph helped the Glasgow club moved six points clear of their nearest rivals St. Johnstone in third spot in the top flight table.
Pedro Caixinha made two changes to the team which had taken to the field in midweek with Jon Toral and Miller coming in for Andy Halliday and Barrie McKay, who both dropped to the bench, in midfield.
David Bates, 20, and Myles Beerman, who had made their Rangers debuts in the 0-0 draw with Kilmarnock at Rugby Park five days earlier retained their places at centre half and left back respectively.
There was a flashpoint in just the third minute of the game after Joe Garner took exception to a crude challenge from Ryan Jack. He squared up to his opponent who responded foolishly and thrust his face into his rival.
Garner went to ground as if he had been hooked in the jaw by Tyson Fury - but television replays showed that there had been contact in an incident which took place directly in front of referee Kevin Clancy.
Clancy booked both men for their part in the set-to. Jack, the home team’s captain, would have been the less aggrieved of the two after only receiving a caution. Technically, the match official would have been entitled to send him off.
Jonny Hayes forced a decent save from Foderingham in the seventh minute after making a searing break down the left wing. But it was one of few chances the home team created in the opening 45 minutes.
The visitors should have gone in front after Kenny McLean was dispossessed by Martyn Waghorn. The home team had their keeper Joe Lewis to thank for keeping them level. He produced a fine double save from Waghorn and then Garner in the 11th minute.
A rare piece of quality play from Aberdeen eight minutes before half-time, though, should have seen them take the lead. An Adam Rooney pass sent McLean into space in the Rangers penalty area and he cut the ball back to Graeme Shinnie. But Niall McGinn stuck his leg out just before it reached his team mate and the attack broke down.
Aberdeen were, no doubt as a result of a half-time rollicking by their manager Derek McInnes a different team in the second half. They dominated Rangers and would have taken the lead had it not been for the brilliance of Foderingham in goals.
The keeper denied Shinnie, McLean and Adam Rooney twice during a period when his side was . The last of those was the best. He pushed a powerful shot by the striker wide of his post on the hour mark.
Caixinha removed Emerson Hyndman and put on Josh Windass, but the substitution made little difference. The game looked to be heading for a goalless draw until its dramatic finale.
Lewis could only palm a Waghorn shot into the path of Miller in the 79th minute and the veteran striker rifled a powerful right foot shot into the roof of the net.
He added his second just a minute later after Anthony ‘O’Connor had gifted Dodoo, who had just come on for Garner, possession needlessly. The Englishman supplied Miller who coolly slotted home.
It was Dodoo’s turn to get in on the goals three minutes later. He cut inside form the left and fired low beyond the keeper to send the visiting fans wild.
Dodoo struck the crossbar and Miller had a header cleared off the line in injury-time.