An error by goalkeeper Allan McGregor set up a tense finale to a match Rangers looked to have under control.
Kyle Lafferty's clinical shot in 58 minutes put the visitors in front and a Nikica Jelavic penalty doubled their advantage in a bruising league clash.
But with eight minutes to go, McGregor allowed a thumped Ricky Foster 25-yard shot to pass through his gloves.
Dons' Rob Milsom and Rangers' Steven Naismith sustained nasty leg injuries and Rory Fallon was sent off.
The eventual victory at Pittodrie makes it seven away wins on the trot in the Scottish Premier League for leaders Rangers.
There were early signs that the match would be a battle for both sides.
With the ball bobbling around the midfield and each side guilty of gifting possession to the opposition, it was Milsom who displayed the best touches, notably using his gifted left foot to bamboozle Steven Whittaker and cross into the box.
Kari Arnason was cautioned by Willie Collum for a late sliding challenge on visting captain Steven Davis but the Icelandic midfield regained his composure straight away, rifling a right foot shot from 35 yards that McGregor smothered to his left.
Jelavic was back in the Rangers line-up after injury - Lafferty making way for the Croatian striker - and he upset Dons defender Youl Mawene when the pair contested a Naismith cross into the box and Jelavic fell in the box.
Naismith's match was curtailed before the mid-point of the first half. He tackled Milsom clumsily - the Dons man was subbed for a nasty gash on his lower leg - and the little attacker received treatment on his twisted right knee for several minutes, but escaped without a booking.
However, in Naismith's first involvement thereafter he crumpled to the turf, clutching his right knee, and was stretchered off in evident pain.
Darren Mackie came on for the Dons, Lafferty for Rangers: both contributed to chances for their teams.
The Rangers sub whipped a cross from the right touchline that soared over the heads of two Dons defenders at the front post. At the back post, though, Rory McArdle chose to let the ball pass him by, yet Sasa Papac drifted in on his blind-side and headed wide of the gaping goal.
At the other end Chris Clark burst into the box but McGregor was out quickly and made the block.
Mackie made for the loose ball and went down in the box with he and Dorin Goian at full stretch. Replays suggested he had slipped but Dons boss Craig Brown's protestations attracted a telling-off from Collum, who was well placed for the incident.
With no goals at half-time, Rangers had the first chance after the interval.
Whittaker curled a fantastic ball into the box and Jelavic nicked ahead of the Dons defence to meet it with his chest. David Gonzalez made his first telling save of the game at close range and Andrew Considine was sharp to deny Lee McCulloch the follow-up.
Lafferty drew a smart save from Gonzalez with a long-range free-kick before Rangers edged ahead on 58 minutes.
Mawene dithered on the edge of the box, Maurice Edu pounced on a Foster slip and when the ball broke to Davis he coolly slipped the ball to Lafferty on his right for the sub to arrow a low shot into the far corner.
The visitors turned the screw in 70 minutes when Jelavic won a race into the box and crossed for Papac, eight yards from goal, who was scythed by the desperate Mackie.
The Dons striker was booked before Jelavic fired his penalty straight into the middle of the goal.
As the physical encounter continued, Considine was left in Jelavic's wake as he bore down on goal and was shown a yellow card for a brutal challenge to halt the move.
Aberdeen played with renewed vigour in the final period of the game when Foster halved the deficit with a 25-yard smack that McGregor looked to have covered but merely diverted into his goal.
As the game moved into extra-time, Dons striker Rory Fallon was sent off for using an elbow on Goian.