Michael Donald put the visitors in front before Leighton McIntosh levelled matters with his 14th goal this season.
Blackburn loanee Preston put Ayr back in front just before the break.
Patrick Boyle set up Preston for his second and Robbie Crawford made it four to give Peterhead a tough ask in Saturday's second leg.
Jordan Preston scored twice as Ayr United claimed the initiative in the Championship play-off semi-final against Peterhead.