Last year's runner-up Louis The Pious, trained by David O'Meara, won the Ayr Gold Cup to complete a 769-1 treble for jockey James Doyle.
The 10-1 chance triumphed by two and three quarter lengths, with Minalisa (33-1) in second.
Victory sealed a great week for the horse's owner Frank Gillespie, who enjoyed an Irish Champion Stakes win last Saturday with The Grey Gatsby.
Favourite Blaine, ridden by Amy Ryan, was third ahead of Heaven's Guest.
Ryan was bidding to become the first female jockey to win Scotland's top flat race.
But she had too settle for third as Doyle, fresh from victories on Power Play (6-1) and Huntsmans Close (9-1), secured another triumph.
Riding at the course for only the second time, he ensured his mount - drawn 19 of 27 - was quickly on the rail of the favoured stands side.
"It was a golden highway up that rail, but I can't take any credit. David and his team have done a fantastic job with this lad," said Doyle.
William Hill Ayr Gold Cup
1 Louis The Pious (David O'Meara) (J Doyle, 10/1)
2 Minalisa 33-1
3 Blaine 7-1
4 Heaven's Guest 12-1
5 Fast Shot 20-1
Dist: 2¾ lengths, Head, Neck. 27 ran