Ayr seemed on course for a comfortable victory over Edinburgh Accies having taken first use of an easy-paced Cambusdoon wicket to run up 275 for the loss of only Bruce Patterson, who made 17.
Australian professional Kevin Roberts and Alan Simpson plundered a modest Accies attack, each registering centuries.
Roberts quickly undermined Accies' batting with an early breakthrough and with Andy Baird plugging away remorselessly, victory seemed to be a formality.
But Simon Dillon and David Hill added 41 in an eighth wicket stand before Roberts dismissed Hill.