Ayr made it three successive away wins and leapfrogged Dunfermline in the cinch Championship table with a 1-0 victory at East End Park.
The Pars should have taken an early lead when Josh Edwards blazed over and were made to pay in the 10th minute as Logan Chalmers scored his fourth goal in as many games after some excellent build-up play.
The visitors went close to doubling their lead shortly afterwards when Mark McKenzie ran clear only for Aaron Comrie to make a last-ditch tackle which prompted Dunfermline manager Jake McPake to make a double substitution.
The hosts piled on the pressure after the break and went closest through Ben Summers, whose shot struck a post and the follow-up from Alex Jakubiak was brilliantly saved by Charlie Albinson.