Soldier In Action battled on bravely to get up in the shadow of the post to claim the Qatar Summer Handicap at Goodwood.
The top-weight came with a rattling run in the centre of the course under Silvestre de Sousa to give trainer Mark Johnston another winner at his happy hunting ground.
Soldier In Action (11-1) snatched victory from Blakeney Point and Getback To Paris by a head and a short head, in a thrilling finish to the mile-and-three-quarter test.
Johnston said: "I thought a furlong and a half out he had come to win, then I definitely thought he wasn't going to win it as the others picked up again in front.
"It is just fantastic when you get a finish like that over a mile and three quarters.
"He will probably go to the Ebor. We don't think his best form is on firm ground, we thought the ground was a plus today.
"He took a while to recover from going over hurdles (with Nicky Henderson). He lost an awful lot of weight and it took a while to get him back on form. He is having a great season now."
Owner Alan Spence said: "I thought he was going to win quite easily a furlong and a half out, then just when he got there the others did a quick burst. I didn't think he had won by a head, I thought it was shorter.
"He is better with a bit of cut in the ground and now we just want a bit of soft ground at York for the Ebor, as that is the logical race."