Mark McKenzie's first two goals for Ayr helped them to a 3-1 win at Dundee in the Scottish Championship.
Ayr keeper Viljami Sinisalo denied Max Anderson before McKenzie gave the visitors an 18th-minute lead after good work by Luke McCowan.
There was no further score in the first half, despite Aaron Muirhead going close with a volley, but Cammy Smith put Ayr two up early in the second period from Patrick Reading's brilliant run and cross.
McKenzie made the game safe in the 84th minute with a fierce strike from the edge of the box, with Osman Sow's goal two minutes later a mere consolation for the hosts.