Racing: Advanced (20-1) got up in the shadow of the post to pip Benwilt Breeze in the totesport.com Ayr Gold Cup.
Jamie Spencer came with a devastating late run on the stands side rail to land the spoils for trainer Kevin Ryan.
Benwilt Breeze (22-1), trained in Ireland by Ger Lyons, was a neck away second in the centre of the course with Patavellian (100-1) a length and three-quarters away in third and Beaver Patrol (20-1) was fourth.
The 28-strong field split into two groups with King Orchisios taking them along on the far side with Borderlescott, Majestic Times and Beaver Patrol close to the lead near the stands rail.
Benwilt Breeze came towards the centre of the course from his low draw to claim a definite advantage which looked like taking him all the way to the line.
However, Advanced, who was third 12 months ago, came with a power-packed finish to snatch the honours.
Spencer said afterwards: "I thought I was beat because Eddie (Ahern) punched the air. I knew it was pretty close.
"The ground is very testing so it was a good performance under 9st 9lb. He was third in the race last year as a three-year-old.
"We were spread right across the course and were all going hell for leather. I just hoped to get there on time."
Ryan added: "Last year in fairness Neil (Callan) wanted to go on the far side where the winner came from and I told him to stay on this side, but it's all gone to plan this year. It's a race I've always wanted to win, so this is very important.
"I told Jamie to ride him as he found him. He's a very good horse. After he got beat in this race last year he went to France and was just beaten in a Group Three."
However, there was a sting in the tail for Spencer in his bid to regain the jockeys' championship as he was suspended for two days (October 3 and 4) for careless riding.