With Fame And Glory fading fast, four horses fought for the win inside the final furlong.
16-1 chance Royal Diamond, ridden by Niall McCullagh, did the business for Tommy Carmody after Massiyn (13-2) briefly pulled ahead in the final 100 yards.
Brown Panther (10-3) was third ahead of Aiken.
"This is fabulous, much better than riding them," said former jockey Carmody.
"When you ride them you just come in, say your piece and then you're gone but when you're training them you live and sleep with them."
It was McCullagh's first Irish Classic win.
"This is what all the early mornings and hard work is for," he said. "My initial plan was to get cover and sit fourth but he ran keen and down the straight he came alive...
"He battled all the way to the line and he never flinched. I had an inkling that maybe I might have just got there and I was relieved when the result was called."
2-5 favourite Dawn Approach triumphed in the Group 1 Goffs Vincent O'Brien Stakes.
He now has five wins from five after coming home four and three quarter lengths clear of 28-1 shot Designs on Rome and is a strong favourite for the 2000 Guineas at Newmarket next year.
Flying The Flag was clear in the first half of the race but struggled thereafter and finished down in seventh, with Leitir Mor (12-1) third, another four lengths back.