Wescott struggled in qualifying and was seeded 17th out of the 32 riders, but he emerged with his second gold medal and America's second of the Winter Olympics.
In the final, Wescott was barely within shouting distance of Robertson. Then, out of nowhere, the 33-year-old snowboarder closed the gap, passed the Canadian and held him off at the finish.
Tony Ramoin of France won the bronze, finishing ahead of American Nate Holland, whose spinout about a third of the way down the course set up what looked like would be a breeze for Robertson, an underdog who was going for his country's second gold medal of the games.
Wescott made up his deficit over a series of five consecutive jumps that can sap speed if not executed correctly. The crowd, about half Canadian and half American, gasped and cheered. Wescott crossed the finish line and fell to the ground, then draped his country's flag across his shoulders.
It was a result that was hard to believe not so much because of Wescott's history in the sport, but because of his recent form.
Wescott hurt his knee and shoulder at an event two months ago and came to the Olympics admittedly not riding his best. He was also one of the few riders who acknowledged the conditions at weather-plagued Cypress Mountain slushy, flat light, inconsistent snow were crummy.
"You're pretty much riding blind in there," he said between qualifying and the finals.
His low seeding meant he had to wear the black vest for the final three races he ran. The top seed gets to wear red.
But the man in black, a technician who prides himself on finding the winning paths down any course, won the gold.