Circus Maximus dropped back down to a mile to win the St James's Palace Stakes under a determined Ryan Moore drive.
Sixth in the Investec Derby at Epsom on his latest outing, the son of Galileo was a surprise supplementary entry for this race last week - dropping half a mile in distance.
Fitted with blinkers for the first time, the 10-1 winner hit the front racing inside the final two furlongs and was all out to deny the fast-finishing King Of Comedy by a neck.
Well-backed favourite Too Darn Hot was close-up in third, but Irish 2,000 Guineas hero Phoenix Of Spain could only finish a disappointing sixth.
O'Brien said: "Derrick (Smith), John (Magnier) and Michael (Tabor) all decided between themselves (to run in this race) and at 11.45am (on the day of supplementary entries) they let us know that they were thinking of doing this and we ran with it.
"It's hard to believe and we're just privileged to be a small part of it.
"It was a big challenge for the horse and it was a very difficult one to deal with - coming back (in trip) like that - and that's why he had the blinkers on, because he didn't have much time to learn."
Frankie Dettori said of the beaten Too Darn Hot: "He came there to win and I hit the front, but in the last 100 yards he didn't have the legs for it.
"I think the stiff mile at Ascot was too much."