Aidan O'Brien saddled his 26th Group One winner of 2017 - beating the record of the great Bobby Frankel - as Saxon Warrior took the Racing Post Trophy.
Sent off 13/8 favourite, the son of Deep Impact appeared to be in full control he cruised to the front two from home, but then looked in trouble as Roaring Lion burst from the pack to take over and briefly move a length clear.
With Ryan Moore in full flight, Saxon Warrior dug deep to stay on again and reel in the John Gosden-trained runner-up with the line approaching, sealing O'Brien's 26th and perhaps most dramatic top-level success of another phenomenal season.
The winner's stablemate, The Pentagon, was third.
O'Brien surpassed the record for number of top-level wins in a calendar year set by American trainer Frankel in 2003.
He told ITV Racing: "I'm delighted and delighted for everybody. There's a lot of hard work put in by a lot of people in Ballydoyle and Coolmore.
"It's unbelievable really. There are so many people who put in so much hard work day in, day out. If I start mentioning people, I'd forget somebody. They know who they are.
"It's a privilege to be working with such special people. We're in a very lucky position and we're a small link in a big chain."
Of Saxon Warrior, the trainer added: "He travelled very strong and Ryan gave him a brilliant ride.
"When John's horse went by him you thought he was beaten, but he found plenty and we're delighted."
Spokesman Michael Shinners said: "What a dramatic way to seal the record and the way they work at Ballydoyle, you'd think the aim for next year will be to beat whatever figure they end 2017 on!
"Saxon Warrior looks a prime candidate to help with that quest but we rate him more a Derby than a Guineas type - although who's to say he can't win both?"
More reaction from Doncaster
O'Brien paid tribute to the Coolmore triumvirate of John Magnier, Michael Tabor and Derrick Smith for producing such incredible thoroughbreds for him to train.
He said: "You're always afraid when you want something to happen, it doesn't happen.
"I couldn't believe it when this horse came back. When John's horse came by him I said 'that's it, he'll be second', but Ryan really conjured a new run out of him.
"It's been a funny year really. A lot of horses have progressed and progressed. There were so many horses like that, it was unusual.
"A lot of very well-bred horses just got better and better. The lads have an unbelievable band of mares and stallions and there are a lot of horses with blue chip pedigrees.
"The genes are obviously there if you can get them to fire up."
O'Brien added of Saxon Warrior: "He travelled very well. Ryan said he surprised him how quickly he jumped into it.
"He was very impressed with him and he's a horse to really look forward to.
"He's a very special horse, we think. He's done everything we've asked of him and he's only been a baby.
"Originally we thought we'd get one run into him (this year). He had that run and then we said we might chance another and then he won in Naas.
"He came out of Naas so well we said we'd come here. It's incredible really.
"I'd say there's no doubt he'll be better on better ground."
Paul Smith, son of Saxon Warrior's part-owner Derrick Smith, told At The Races: "I'm so pleased for Aidan and everyone at Ballydoyle.
"It wasn't straightforward, but I've spoken to Ryan (Moore) and he was very happy and very complimentary about the horse.
"He travelled beautifully and quickened up when John Gosden's horse came alongside.
"He's still a bit inexperienced and still a bit green and there's a very strong crosswind as well.
"He travelled well and toughed it out well, which are the qualities you need in a good horse."
John Gosden, trainer of Roaring Lion, added: "It's a fabulous achievement. He's a great man to compete against and to get 26 in one year is incredible."