Rangers remained on course for a domestic treble when Kris Boyd grabbed a late winner against St Mirren to send the holders into the quarter-finals of the Active Nation Scottish Cup.
The last round against Hamilton had been decided after extra-time and this replay looked set for a similar outcome before the prolific hitman pounced with just four minutes to go to claim the decisive goal.
Rangers - who will face Saints again in next month's Co-operative Insurance Cup final - will take on Dundee United back here at Ibrox as they bid to take another step closer to retaining the silverware.
Walter Smith made no fewer than six changes from the side who defeated Hibernian at the weekend for tonight's clash.
Nacho Novo, Kyle Lafferty, Steven Naismith, Maurice Edu, Steven Smith and Kirk Broadfoot were all drafted into the starting line-up for the fifth round tie.
In contrast, Saints made just one change after their last-gasp defeat to Dundee United, with the injured Steven Robb missing out and Chris Innes back in the team.
Rangers dominated early on and were not too far away when Boyd slipped a lovely ball through to Steven Naismith who bore down on goal before drilling across the face of goal and inches wide of the target.
At the other end, Saints had the chance to pile on the pressure when Andy Dorman whipped a corner into the packed goalmouth only for Michael Higdon to nod just wide.
Meanwhile, Rangers continued to produce some nice football but were struggling to find an end product.
Lafferty released Smith down the left flank and he squared across goal for the on-rushing Boyd but goalkeeper Paul Gallacher was alert enough to snuff out the move before the striker could connect six yards out.
Novo then slotted into the path of Naismith with only the keeper to beat but he connected awkwardly and stabbed straight into the hands of Gallacher who was grateful to smother.
Davis thought he had grabbed the opener shortly before the interval with a thunderous shot from 22 yards that whistled inches over, with the Saints keeper looking like he would have been beaten had the effort been on target.
Rangers could have had a penalty a few minutes after the restart when Davis went to ground under pressure from David Barron but no spot-kick was forthcoming from referee Iain Brines.
Seconds later, Boyd had the ball in the back of the net after being teed up for the shot by Novo but the assistant referee had already flagged for offside to the groans of the Ibrox crowd.
The striker then had the best chance of the game so far when he forced Gallacher into an impressive one-handed save to tip his powerful volley just over.
Saints provided a timely reminder that they were still well and truly in the tie when Innes rose above everyone else in the box to meet Dorman's corner and saw his header dip inches over the crossbar.
Dorman then collected a poor clearance from Madjid Bougherra and attempted to pick out Higdon in the six-yard box but goalkeeper Allan McGregor claimed before the striker could pull the trigger.
Rangers threw Miller into the action for Novo with around 20 minutes to go, while Jack Ross - who had picked up a knock earlier in the game - was withdrawn for Stephen O'Donnell.
It was Davis who could have made the difference when he embarked on an impressive run into the box from the right flank but saw his shot blocked at the near post by the keeper before a Saints defender hooked to safety with Boyd loitering in front of goal.
Boyd had the final say when he netted the winner with four minutes to go. A long ball from Smith was nodded on by Broadfoot and the striker did well to shrug off John Potter before lashing into the back of the net.