Two late goals from Neil Gauld completed a stunning comeback as Highland League outfit Inverurie Loco Works came from three goals down at Harlaw Park to force a replay with Arbroath.
The Second Division visitors took the lead from the penalty spot after only five minutes.
Neil McLean brought down Steven Doris before he stepped up to convert the kick himself.
Paul Currie doubled the advantage after23 minutes, producing a fine curled effort from the edge after a good knock down from Derek Holmes.
Victory looked all but ensured minutes before the hour-mark when Holmes, again the provider, set up Darren Gribben for a simple finish inside the six-yard box.
However, the hosts pulled a goal back after 67 minutes through Clark Bain, who was well placed to convert Jamie Michie's cross.
Gauld pulled another back from close range four minutes from time before Bain played him through to ensure a replay in the final minute.