Chad Kerley has had plenty of experience dealing with anxiety. After winning the gold medal in BMX Street at the 2013 X Games, beating legendary rider Garrett Reynolds, he felt so much pressure to repeat that it threw him off his game for years.

The San Diego resident had been chasing that past ever since.

Friday, he shoved aside his nerves to score an epic upset, dethroning Reynolds with a spectacular second run on the U.S. Bank Stadium course.

In a competition that seemed like a sure thing until it wasn't, Kerley, 24, put down a score of 92.33 on his final run and got the gold when Reynolds' foot slipped off a pedal late in his second run.

The anxiety, however, wasn't completely banished. Before the medal ceremony, Kerley went back to his hotel room and threw up, overcome by what he had just accomplished.

"I don't even know what to feel,'' Kerley said. "I can't believe it. What a dream come true.

"This gold means more to me than the first one. After the first one, I hadn't been on the podium in four years; I didn't even make the top five. This time, I tried not to think about that and just ride.''

BMX Street has been part of 11 X Games, and Reynolds, 27, had won it 10 times. His only loss was to Kerley five years ago in Los Angeles.

In BMX Street, riders try to impress the judges with as many top-shelf tricks as they can cram into 45 seconds. Reynolds was heavily favored to earn another gold Friday. An idol of younger riders, he is known for pushing the sport forward with his inventive moves, and he is one of the most cool-headed competitors in the sport.

Reynolds applauded Kerley's score of 89.33 on the first run, then went out and bested it with a 91.33. But Kerley kept his wits. Each rider gets two runs, with the higher score counting—and with one solid go-round under his belt, he decided to throw out his planned second run and just let the spirit move him.

"I knew I had to try harder tricks,'' he said. "The way I started gave me a bunch of energy, and I was just winging it from there.''

Kerley's second run was a marvel of precision, skill and guts. In between spins, he showed off his balance with a few "nose wheelies"—riding on just the front wheel—on the rails and the flats, punctuating one with a spin of the handlebars as he flew off the rail. For good measure, Kerley completed some tricks he never had tried in competition.

When he finished, Kerley got a round of hugs from fellow competitors and hearty applause from Reynolds. But the rider Kerley calls "the Michael Jordan or Kobe Bryant of our sport" had one last chance.

While Kerley bit his nails, Reynolds posted a score of 88.66, giving him the silver medal and delivering Kerley the shock of a lifetime.

"The last few years made me feel like I didn't have it any more,'' he said. "This is a super surprise.''