Dunfermline Athletic 1-0 Ayr United

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.

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 .

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."