Dunfermline Athletic beat Ayr United in a replay to set up a Scottish Cup fifth-round meeting with Rangers.
Ryan Thomson came close to opening the scoring in the first half, his effort saved well by visiting goalkeeper David Hutton.
But Thomson headed the Pars in front from Alex Whittle's cross on the hour mark.
Michael Moffat headed wide and was then denied by a fine Ryan Scully block as Ayr tried to force a leveller.
But Dunfermline avoided extra-time, to the delight of the home fans.
Saturday's meeting of the two sides had ended 1-1
with Ayr coming back to force the replay.
And the combined threat of Thomson and Ryan Wallace caused Ayr problems at East End Park, with the former denied by a fine save from Hutton midway through the first half.
Thomson's goal secured Dunfermline a trip to Ibrox
The Pars dominated possession as half-time approached but could not break down their visitors.
However, Dunfermline got a reward for their pressure when Thomson nodded Whittle's cross towards goal and Hutton could not keep the effort out.
Ayr tried to respond but Moffat was unable to direct his header on target.
And, after Dunfermline's Alan Smith had fired wide, Moffat came close to levelling for Ayr.
The forward unleashed a shot from the middle of the penalty area only for Scully to make an impressive save.
And that proved crucial in securing the Fife side's place in the next round.
Jim Jefferies' men, who are currently trailing leaders Rangers in Scottish League One, will visit Ibrox when
the fifth round takes place in February
Dunfermline forward Craig Dargo:
"Over the piece I thought we dominated a bit but Ayr are a very astute team and they were dangerous on the counter.
"I thought the win was deserved and it was a great goal by Ryan Thomson.
"Ayr were hard to break down. With the amount of possession we had, I felt it was only going to take time. If we kept doing the right things we'd get our goal and thankfully we did.
"We knew what was at stake, we knew we had a trip to Rangers and we've already played them and there wasn't too much between the teams so it should be a mouth-watering tie."
Ayr United player-manager Mark Roberts:
"When they got the goal, we probably played for half-an-hour when we had a go at them.
"For me, it's too little, too late. If we had done that from the first whistle, we'd probably have had a real chance of still being in the cup.
"The guys gave everything in the last half-hour but it wasn't to be.
"To be fair, Dunfermline deserved to win."
- 01 Scully
- 02 Millen Booked
- 03 Whittle
- 07 Byrne
- 04 Young Booked
- 05 Morris Booked
- 06 Geggan
- 10 Falkingham
- 09 Wallace (Husband - 93' )
- 08 Smith (Dargo - 74' )
- 11 Thomson Booked
- 12 Moore
- 14 Dargo
- 15 Martin
- 16 Husband
- 17 Ferguson
- 18 Williamson
- 20 Goodfellow
- 01 Hutton
- 02 Hunter Booked
- 03 Pope Booked
- 06 Gilmour
- 04 McLaughlin
- 05 Lithgow
- 07 Marenghi Booked (Malcolm - 68' )
- 08 Crawford (Forrest - 60' )
- 10 Kyle
- 09 Moffat
- 11 Donald
- 12 Malcolm
- 14 Forrest
- 15 McGowan
- 16 McCracken
- 17 Wardrobe
- 18 Longridge
- 19 Muir
Ref: Stephen Finnie