Wilde was a long way back in the field after the first leg, the swim, but made up ground in the second leg, the cycling, to put himself in medal contention.
He then poured on the power during the run to open up a 15-second lead over the favourite, Britain's Alex Yee, going into the final lap before Yee found some gas in the final stages to edge the Kiwi on the line.
France's Leo Bergere was third
New Zealand's other entrant, Dylan McCullough, finished back in the field.
The Black Ferns Sevens got New Zealand on the medal table earlier today, winning gold in the women's competition.