Match ends, Kilmarnock 1, Rangers 2.
A stunning last-minute strike from substitute Nicky Clark took Rangers into the quarter-finals of the Scottish Cup at Kilmarnock's expense.
Martyn Waghorn's early penalty was cancelled out by a fine Rory McKenzie strike in the pouring rain.
Rangers dominance finally paid off just as the game was heading to extra time when Clark fired in at the near post.
Victory over the Premiership side gives the Championship leaders a home tie against Dundee or Dumbarton.
Given their impressive 2-0 league win over Motherwell and the appointment of new manager Lee Clark, the home side had good reason to go into the game with confidence.
The 13,179 who braved the weather huddled under the Rugby Park stands as the incessant wind and rain lashed the players, but the Rangers supporters were on their feet after only two minutes.
Stuart Findlay brought down the advancing Waghorn just inside the box and referee Bobby Madden immediately pointed to the spot.
The Englishman looked to be struggling after the challenge, but he stepped up to send Jamie MacDonald the wrong way before his game was over and Clark replaced him.
The question was how would the home side respond.
The answer came four minutes later, when McKenzie found some space just inside the Rangers box and fired the ball low past goalkeeper Wes Foderingham to level.
A stunning strike and a stunning start to this cup tie despite the rain's best efforts to dampen the occasion.
With tails well and truly up, Kilmarnock went looking for another and they probably should have taken the lead through Josh Magennis.
The Irishman caught Dominic Ball in possession and raced through on goal, but just as he prepared to shoot, Rob Kiernan slid in with a timely intervention to clear the danger.
After that, the game settled down and both sides traded blow after blow as the match swung from end to end.
Craig Slater forced a good save from Foderingham from distance and, at the other end, Kenny Miller pulled his shot just wide from eight yards.
The visitors started the second half with tremendous energy and intent, with Barrie McKay and James Tavernier both coming close.
McKay's fizzing volley flew just wide and Tavernier's long-range effort forced a good save from MacDonald.
As Rangers piled forward in numbers, they were leaving gaps at the back and Tope Obadeyi was finding space on the left, but despite some good runs, the Kilmarnock attacks were coming to nothing.
Rangers claims for a penalty on the hour also came to nothing. Lee Ashcroft looked to hold Kenny Miller back inside the box, but referee Bobby Madden was not interested despite the howls from the Rangers fans behind the goal.
What followed was a period of intense Rangers pressure as the Kilmarnock defence continued to bounce off the ropes.
Just as it looked like they would hold on for extra time, the killer blow came courtesy of Clark.
He bulleted the ball in at the near post after an inch-perfect corner from McKay to send Kilmarnock out of the cup.
- 3SmithSubstituted forAshcroftat 28'minutes
- 19SlaterBooked at 90mins
- 23KiltieBooked at 71mins
- 16ObadeyiSubstituted forFrizzellat 79'minutes
- 6BallBooked at 30minsSubstituted forShielsat 59'minutes
- 33WaghornSubstituted forClarkat 7'minutesBooked at 90mins
- 9MillerSubstituted forForresterat 71'minutes
- Bobby Madden
- Shots on Target
Second Half ends, Kilmarnock 1, Rangers 2.
Craig Slater (Kilmarnock) is shown the yellow card for a bad foul.
Harry Forrester (Rangers) wins a free kick in the defensive half.
Foul by Stuart Findlay (Kilmarnock).
Nicky Clark (Rangers) is shown the yellow card for excessive celebration.
Goal! Kilmarnock 1, Rangers 2. Nicky Clark (Rangers) left footed shot from the centre of the box to the bottom left corner. Assisted by Barrie McKay with a cross following a corner.
Corner, Rangers. Conceded by Gary Dicker.
Attempt blocked. Harry Forrester (Rangers) left footed shot from the centre of the box is blocked.
Jason Holt (Rangers) wins a free kick on the right wing.
Foul by Adam Frizzell (Kilmarnock).
Andy Halliday (Rangers) wins a free kick on the right wing.
Foul by Josh Magennis (Kilmarnock).
Corner, Rangers. Conceded by Stuart Findlay.
Attempt blocked. Lee Wallace (Rangers) right footed shot from outside the box is blocked.
Foul by Harry Forrester (Rangers).
Rory McKenzie (Kilmarnock) wins a free kick on the right wing.
James Tavernier (Rangers) wins a free kick in the defensive half.
Foul by Adam Frizzell (Kilmarnock).
Substitution, Kilmarnock. Adam Frizzell replaces Tope Obadeyi.