The Dons looked set to maintain their impressive home record over the Ibrox side when they raced into a two-goal lead thanks to first-half strikes from Scott Vernon and Chris Maguire, who was sent off in the closing stages for a second booking.
In-form Miller, however, pulled a goal back from the spot after Vladimir Weiss had been brought down by Jerel Ifil to keep his side in the match after 34 minutes.
The Scotland striker netted his 10th goal of the season after 52 minutes when he was on hand to turn home Steven Davis' cut-back and the comeback was complete when Steven Naismith beat the offside trap to unselfishly set up Nikica Jelavic for an easy finish.
Rangers made six changes for their trip to Pittodrie with Kyle Lafferty on the bench, despite scoring a hat-trick in the Light Blues' 7-2 Co-operative Insurance Cup midweek win over Dunfermline. Miller returned in his place, while there were also starts for Allan McGregor, David Weir, Sasa Papac, Lee McCulloch and Steven Whittaker.
Aberdeen, without captain Paul Hartley who strained a hamstring in their League Cup victory over Raith Rovers, made two changes. Defender Nikola Vujadinovic stepped in for Hartley, while striker Darren Mackie replaced Mitchel Megginson.
Dons boss Mark McGhee had joked before the game that he may have to start the match with six defenders in order to nullify a Rangers team that had scored 11 times in their previous two matches. Instead, he opted for a four-man defence with right-back Rory McArdle pushed forward into midfield.
The home side broke the deadlock after 10 minutes when Vernon timed his run perfectly to latch onto Maguire's neat pass and slot the ball past McGregor for his fifth goal in four games.
Rangers increased the pressure as they searched for an equaliser with Miller stinging the palms of Jamie Langfield, before an enticing centre from Vladimir Weiss found no takers.
Aberdeen were defending their lead resolutely, although Steven Naismith was given a glimpse of goal after exchanging passes with Jelavic but failed to find the target.
With 30 minutes gone the Dons doubled their lead when Maguire reacted quickest to turn Mackie's low cross past McGregor.
Rangers had the chance to pull a goal back within four minutes when Ifil brought Weiss down in the area, with Zander Diamond and Naismith picking up bookings for their parts in a melee which followed the decision.
Miller held his nerve to net from the spot and continue his record of scoring in every league game this season.
The striker turned creator in the closing stages of the action-packed half to cross for Papac but the Bosnian's header was well held by Langfield.
Rangers levelled within seven minutes of the restart. Naismith released Davis, who threaded the ball across goal to give Miller the easiest of finishes and his 10th league goal of the season.
Aberdeen were looking increasingly rattled and almost paid the price after 59 minutes when Davis teed up Jelavic, whose curling shot struck Langfield's post.
In a rare Dons attack, a terrific header from Togolese midfielder Yoann Folly drew a fine save from McGregor.
However Rangers got the game's decisive fifth goal when McCulloch pounced on Langfield's poor clearance to release Naismith past a static Aberdeen defence. The former Kilmarnock striker raced through on goal before unselfishly setting up Jelavic to tap the ball into the unguarded net.
Maguire was unlucky after cutting inside from the left and unleashing a powerful drive that went just past the post.
With 15 minutes remaining Aberdeen made an attacking change, withdrawing defender Andrew Considine for striker Josh Magennis, while the injured Steven Davis was replaced by Maurice Edu for Rangers.
Aberdeen's misery was compounded when, with four minutes remaining, Maguire was shown a second yellow card for a challenge on Naismith.
And Rangers clung on to win for the first time at Pittodrie since 2006, despite some sustained Aberdeen pressure in the closing stages.