Law student Craig McCracken scored the winner against his old team as Scottish Juniors side Auchinleck Talbot stunned Championship neighbours Ayr 1-0 to reach the last 16 of the William Hill Scottish Cup for the first time in their history.
McCracken headed home a free-kick in the 77th minute to earn Auchinleck their first win over a Scottish Football League outfit.
Ayr, last season's Scottish Junior Cup winners, became the sixth team Auchinleck have dispatched in the competition this season as the team fighting for promotion to the Ladbrokes Premiership came horribly unstuck at Beechwood Park.
And the underdogs were good value for their win, Graham Wilson having a goal ruled out for offside and Dwayne Hyslop heading a chance wide from six yards.
The visitors had chances of their own, but they were undone as McCracken settled the Ayrshire derby and left Auchinleck dreaming of a fairytale fifth-round tie.
Championship leaders Ross County claimed the scalp of Motherwell away from home thanks to two goals from Brian Graham early in the second half.
Jake Hastie pulled one back at the death for Well, but they slumped to a 2-1 defeat.
Aberdeen were held to a 1-1 draw by a Stenhousemuir side rooted to the bottom of League One.
Max Lowe gave Aberdeen the lead after 21 minutes, but Mark McGuigan equalised with 20 minutes remaining.
Premiership basement boys Dundee also face a replay, but they had to come from behind at home to Queen of the South of the Championship, Jesse Curran cancelling out Stephen Dobbie's opener.
Premiership strugglers St Mirren came from two goals down with 10 men to win 3-2 at home to Alloa.
The team fighting relegation from the Championship looked on course for an upset as Alan Trouten and Kevin Cawley scored in the first half, either side of a debut red card for Brad Lyons.
Signed on loan from Blackburn, Lyons was shown a second yellow card for diving after only 28 minutes.
But Cody Cooke pulled one back in the 65th minute, Ethan Erhahon got an equaliser in the 85th and Kyle McAllister won it two minutes later.
A flying start helped St Johnstone see off top-flight rivals Hamilton, Jason Kerr scoring after only one minute and Anthony Watt adding a 26th-minute second.
Hibernian were the most convincing of the top-flight sides as they crushed Elgin City 4-0.
Goals from Florian Kamberi, Daryl Horgan and Stephen Mallan with a penalty had the hosts three up at the break, with Horgan getting his second early in the second half.
Kilmarnock defeated League One Forfar 2-0 thanks to goals from Stuart Findlay and Chris Burke.
Inverness thrashed East Kilbride 4-0. Jordan White, Aaron Doran and Liam Polworth scored for the Championship side in the opening half-hour, with a Craig Reid own goal completing a miserable afternoon for the visitors.
Elsewhere, Dundee United beat Montrose 4-0, Partick Thistle were 4-1 winners over Stranraer, Raith Rovers beat Dunfermline 3-0 and East Fife were 2-1 winners over Greenock Morton.