Joe Fanning’s mount was pushed all the way to the line having drifted to the rail after taking up the running in the final furlong.
The judge was required to rule Windhoek the winner, with the winning distances ending up at just a short-head and a neck.
Winning trainer Mark Johnston said: "I can't say we were that hopeful. This horse has been off 330 days, coming back from a fractured pastern and he's had a foot abscess.
"He's about 30 kilos overweight and I thought he'd need it. Joe had the pick of the two and I thought he was wrong. He was right!"