Holders Rangers overcame a determined St Johnstone side to progress to the fifth round of the Scottish Cup.
Saints created the better chances in the first half with Gavin Swankie, Liam Craig and Andy Jackson testing Rangers goalkeeper Allan McGregor.
But it was the visitors who took the lead shortly before half-time when Stuart McCaffrey put into his own net.
Substitute Nacho Novo's simple finish from Steven Davis' centre sealed the win for Walter Smith's side.
Rangers' reward for consigning St Johnstone to a first defeat in 14 matches is an away tie against Forfar Athletic in round five.
The home side came close in the opening minutes when Swankie's curved free-kick shot was beaten out for a corner by McGregor.
At the other end, Pedro Mendes' powerful drive from distance was claimed comfortably by Saints keeper Alan Main.
Interview: Rangers striker Nacho Novo
Rangers threatened again in the 15th minute when captain Barry Ferguson found Kris Boyd on the edge of the box but the striker, the subject of recent interest from Birmingham City, blazed over.
McGregor then tipped Craig's curving shot over the bar after the midfielder had combined well with Jackson.
Craig had another effort at goal when he latched on to a loose ball on the edge of the box and volleyed narrowly wide.
Novo celebrates his late strike for the visitors
Jackson came close to giving St Johnstone the lead after 33 minutes when his shot from Derek Holmes' knock-down was blocked by the feet of McGregor.
Kevin Rutkiewicz was booked for a late challenge on Rangers' Steven Naismith, who was playing his first match since injuring his knee in April's Scottish Cup clash with St Johnstone.
Rangers opened the scoring two minutes before the interval following a mistake by Main.
The goalkeeper's poor clearance was intercepted by Steven Davis, who passed to Boyd on the right and the striker's low cross was diverted past Main by McCaffrey.
Full-back Gary Irvine tested McGregor early in the second half with a left-foot shot before Main needed to punch away Kenny Miller's dangerous cross as Boyd lurked.
Holmes and Rutkiewicz were off-target with headers as Saints pressed for a leveller.
But Rangers doubled their lead with 11 minutes remaining when Davis raced beyond the Saints defence to receive Barry Ferguson's pass and laid the ball into the path of Novo, who slotted into an empty net.
Novo got in behind the St Johnstone defence to set up Davis for a shot over the bar and the the Northern Ireland midfielder then had a shot blocked by Main.
Saints pushed for a late consolation but Madjid Bougherra cleared well under pressure from Chris Millar's low cross.
Davis again set up Novo in injury time but the Spaniard's header from the set piece failed to trouble Main.
St Johnstone manager Derek McInnes:
Interview: St Johnstone manager Derek McInnes
"It was a real blow to go in 1-0 down at half-time. I felt the boys really acquitted themselves well in the first half. We really worked Allan McGregor a few times.
"The first goal was sloppy. Alan Main has made a mistake but he's been terrific for us this season.
"I thought 2-0 was harsh on us but we got a wee bit ragged towards the end and Rangers picked us off.
"We're disappointed we're out of the cup but we know where our priorities lie. We're still 14 games undefeated in the league and we're looking to keep that going."
Rangers assistant manager Ally McCoist:
Interview: Rangers assistant manager Ally McCoist
"We knew it was going to be a very difficult tie. I'm just really pleased we've come through it unscathed.
"We had a couple of shaky moments in the first half but, it being a cup tie, the result was the most important thing.
"Our goalkeeper had a couple of great saves in the first half. He had to be on the top of his game and thankfully he was.
"We weathered the storm a little bit and scored a couple of very good goals."
St Johnstone: Main, Irvine, Rutkiewicz, McCaffrey, Hanlon (Sheerin 71), Millar, Morris, Craig, Swankie (Milne 86), Holmes, Jackson (Samuel 59).
Subs Not Used: McLean, Gartland.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.