Two late goals helped Ayr edge past fellow cinch Championship strugglers Arbroath in challenging conditions at Somerset Park.
Both sides battled heavy rain and wind and looked set to repeat the deadlock from their previous encounter at Gayfield just 10 days ago.
Jamie Murphy missed a chance to put the hosts in front from the penalty spot in the 55th minute when he hit the post and the rebound was pushed out for a corner.
Ben Dempsey finally made the breakthrough in the 74th minute with a brilliant long-range strike, and Logan Chalmers added the second from close range three minutes later to seal the win.
Subscribe or register today to discover more from DonegalLive.ie
Buy the e-paper of the Donegal Democrat, Donegal People's Press, Donegal Post and Inish Times here for instant access to Donegal's premier news titles.
Keep up with the latest news from Donegal with our daily newsletter featuring the most important stories of the day delivered to your inbox every evening at 5pm.