Sunday's game exploded in the 53rd minute when Ibrox midfielder Kevin Thomson was deservedly sent off for a needless and lunging tackle on his St Mirren namesake Steven Thomson.
Then teenage defender Danny Wilson was also red-carded for a last-man challenge on Buddies substitute Craig Dargo, leaving the Govan side two men short for the last 20 minutes.
But with seven minutes remaining, Scotland striker Miller rose in textbook fashion to head substitute Steven Naismith's cross past Paul Gallacher and complete the first part of a possible treble for Walter Smith's men.
Unbeaten in five previous games between the two sides this season, Rangers were overwhelming favourites going in to the game but they were made to work all the way by the Buddies.
Paisley boss Gus MacPherson had gone with the power of Billy Mehmet and Michael Higdon in attack and in the fifth minute, it was the former who escaped Ibrox captain David Weir down the left and drove into the box.
His left-footed cross from the byline spun off Wilson and over Alexander, leaving Sasa Papac to clear from under his bar.
Rangers had to rely on some timely interventions in defence to prevent beaverish St Mirren working their way into some dangerous situations.
However, the enthusiasm of Hugh Murray in his tackle on Lee McCulloch in the 18th minute earned the Paisley midfielder a booking from referee Craig Thomson.
Amid the huffing and puffing, Ibrox right-back Steven Whittaker tried his luck from 30 yards but his low drive was gathered comfortably by Saints keeper Paul Gallacher.
Miller had the best chance of the first half, though, in the 34th minute when he took a Whittaker pass and drifted in to the box with ease only to fire high over the bar.
As the first 45 minutes drew to an end St Mirren began to turn the screw.
Rangers keeper Neil Alexander took a Nacho Novo pass-back and was caught on the byline by on-rushing Jack Ross as he tried to cockily beat the St Mirren defender, the ball running past for a goal kick to the relief of the Rangers supporters.
However, the keeper made up for it in the 40th minute when, with the Light Blues defence in disarray, he blocked a goal-bound shot from Steven Thomson on the line.
Moments later, though, Alexander was well beaten by David Barron's long-range drive which clipped the crossbar on its way over.
When the interval whistle sounded, it was the Paisley side who trooped off cursing their inability, yet again this season, to turn possession into goals.
Steven Davis was replaced by Maurice Edu at the break as Rangers went to three at the back and that substitution and tactical change appeared to spark the Light Blues into a higher gear.
Kevin Thomson drove a left-footed shot wide within a couple of minutes after a Novo free-kick had been cleared to the edge of the box.
In the next few minutes both Miller and Papac had efforts which went high and wide but the Ibrox side now looked a different team.
However, their mood darkened when Thomson was shown a red card.
The decision looked reasonable but the game turned ugly in the subsequent minutes and amid the bitterness, Kris Boyd, anonymous for most of the game, headed a Novo free-kick over the bar.
Higdon fortuitously blocked a Miller shot in a goalmouth scramble as Rangers, fuelled by a sense of injustice, fought back.
Dargo replaced Billy Mehmet in the 70th minute and seconds later the St Mirren substitute was pulled back by Wilson in a 'last-man' situation at the edge of the box which earned the young Ibrox defender a red card, leaving Rangers down to nine men.
Boyd was replaced by Steven Naismith with 11 minutes remaining and in the 83rd minute, in a Rangers breakaway, the former Kilmarnock striker curled a pin-point cross on to the head of Miller who rose to glance his header past Gallacher.
It was a goal fit to win any game and after some desperate defending, Miller and his team-mates deserved the cheers from the Rangers fans when the final whistle blew.