James Doyle brought Secret Advisor with a well-timed run to land a gamble in the Betfred
Melrose Handicap.
The 5-1 favourite made up a lot of ground in the closing stages on the far rail to nail his stablemate Bin Battuta in the dying strides.
Tor was at the forefront of a strong pace that fell apart at the business end of the mile and three-quarters.
Bin Battuta looked like landing the spoils after getting the better of Here And Now, but the Charlie Appleby-trained Secret Advisor delivered a sucker punch to score by a neck and lead home a Godolphin one-two.
Here And Now was a neck away in third, with On To Victory a length and a half back in fourth.
Doyle said: "If you drew a line from his run at Goodwood, where the ground was too soft, he should have been clear favourite anyway.
"He put up a good performance at Royal Ascot and I rode him work the other day on the Limekilns. I was blowing the other day as he's hard work. He's lazy, but he didn't half pick up late on.
"It was a good performance there because we were strung out. I wanted to go up the middle, but I got hampered and the race got away from me so I went over what I thought was the least favoured part of the track."
Alex Merriam, Appleby's assistant, said: "James said that he met trouble in running so he's done well to win in the end.
"He's been consistent this season and deserved that. You could forget his last run at Goodwood as he hated the ground.
"He's a horse for next year, that could be it for this season."