Aidan O'Brien's Continuous came from last to first to produce a superb performance in the Sky Bet Great Voltigeur Stakes at York.
The son of Heart's Cry dead-heated for third in the Dante on the Knavesmire earlier in the campaign and lost little in defeat when runner-up to King George Stakes' third King Of Steel at Royal Ascot.
The well-backed 8/11 market leader Gregory ensured the tempo was solid throughout and Dettori kicked his mount for home a long way out. It soon became clear that Gregory was beginning to paddle out in front as the closers began to mount their challenge.
The Charlie Appleby-trained Castle Way loomed upsides briefly but the eye was always drawn to Continuous, who looked as though he had just joined in as Ryan Moore eased his mount to the front.
Continuous stretched further and further clear with every stride and the 4/1 chance soon found himself bounding to a commanding three-and-three-quarter length success.
Castle Way finished a clear second with Gregory, who was dropping back to a mile and a half following his Royal Ascot, well-held back in third.
The winner was cut from 12/1 to 4/1 favourite for the Doncaster Classic next month and O'Brien suggested a trip to the Town Moor could be very much on the cards.
O'Brien said: "He's a lovely horse who is progressing, he has enough class for a mile and a half and could stay further. He's an exciting horse really.
"He handles an ease in the ground well as he has a bit of a round action, but that was fast ground there today – Ryan said it was quicker than it was at Royal Ascot – and he didn't seem to have any problem with it.
"He came here in the Dante and needed the run very badly and ran a massive race. I said to Ryan before the race today 'would any of those other horses have run as well in the Dante as he did?' and he said they wouldn't. A little bit of class usually outs, especially if the pace is even.
"I asked Ryan about that [the St Leger trip]. He said he doesn't need a mile and six, but he said you wouldn't rule it out."
A trip across to the States looks like an option for runner-up Castle Way, with Appleby stating: "I'm pleased. The fractions looked very quick, and William [Buick] said he was close enough but fair play to the winner, he was the fastest horse in the race.
"The main thing to take out of it is that William did say the mile and six in the Leger will probably stretch him, so where do we go next?
"I think I'll most definitely put him on the radar for Belmont [Jockey Club Derby] where the quick ground will suit him.
"That will most likely be our next stop. He's got a great attitude; he tries but he was beaten by a better horse today."
Gosden confirmed his intentions for Gregory to head the St Leger by saying: "We felt we couldn't go from Royal Ascot to the Leger, so we had to come here, even with a 3lb penalty," he said.
"They went a strong pace and there were two others forcing it, but what I loved about it was that a furlong out he got going again.
"To me, he's run the perfect trial for the Leger. I did say to the owners before the race that I'd asked the course executive if they could move the stalls back to the start of the Ebor, but they wouldn't!
"I couldn't be more pleased as a Leger prep and you can see by the size of him, he's all about next year, one more run in the Leger and then Cup races next year."
Gregory was eased from 9/4 favourite to 5/1 by Paddy Power for the Classic.