It was a record-breaking performance from Bjorn Nielsen's eight-year-old, who moved sweetly to the front before finding enough in the end to land his 18th European Group-race victory.
The John & Thady Gosden-trained entire sat fourth early on behind the pace-setting Thunderous and Franny Norton.
He hit top stride with a quarter of a mile left to travel, but the 6-4 favourite idled once hitting the front as he drifted to the stands rail and had to dig deep as Thunderous fought back.
Yet he had a length to spare at the line from the gallant 17-2 runner-up and will now head to Royal Ascot in a bid to land a fourth Gold Cup, for which he was cut to 3-1 by Betfair and Coral.
The son of Sea The Stars returned to a huge reception from the Knavesmire crowd, after what was a third Yorkshire Cup win.
Gosden senior said: "He hit a little but of a flat spot and the next thing you know, he got Frankie there too soon. It was tremendous, he's a great one for the crowds, isn't he? Someone asked me what it was like and I said 'it's like Desert Orchid'.
"It's great to be six from six on the Knavesmire and be the leading Group-winning horse of all time in Europe, that takes some doing
"As long as the ground doesn't go soft or heavy then we hope to go on to Ascot which has always been the plan – one run, then Ascot. We always said here, Ascot Gold Cup and Goodwood. That, hopefully, is our season, we'll see.
"He's a real character and it's lovely to win that and give weight, he gave 6lb to the good filly (Search For A Song) and 3lb to everything else. Let's hope we can get to Ascot and the ground's not too deep, I think if he had this ground he'd take a lot of beating."
He added: "He's an eight-year-old entire, if he was an eight-year-old gelding it would be a different ball game. He's done well mentally to get himself there, he knows the gallops and he knows everything backwards. I'm quite careful with the way I train him, if you tried to rub his nose in it he'd tell you what to do with the game.
"He was a bundle of fun to saddle, on his hind legs, every time he saw a filly he started showing off but he came over here and he was as professional as ever."
Dettori, who was in flying dismount form, said: "John and Thady have got to take all the credit really. They changed different things to get him interested – worked him from the front and the back, taken him to different places, just to get him motivated as he's been going on those gallops for six years.
"I thought we had him fit, but until you try you don't know because he looks after himself.
He looked the same as he usually does, travelled with zest and showed a good turn of foot and then he pulls up in front, but we know he does that.
"My mouth is a bit dry and I'm emotional, but what an incredible story.
"All roads lead to Ascot for one more roll of the dice. Let's hope the ground stays dry."