The 20-year-old from Coquitlam, B.C., won his fifth and final run to finish with 19 points. But Latvian Rihards Veide finished right behind him to push his total to 20 points and become the fourth and last rider out of their eight-man heat to advance.
"The racing was crazy and everyone's going fast," said an emotional Nyhaug. "I had a lot of fun but it's pretty disappointing not to make it through.
"But I have no regrets and I fought right 'til the end. I have to be proud of myself."
Nyhaug finished third, seventh, sixth, third and first in his five runs, while the Latvian was sixth, fourth, third, fourth and second.
The 32-man field was divided into four heats of eight riders apiece for the quarter-finals, held under a burning sun. Four riders from each group eventually moved on.
Between heats, a DJ played music for the crowd and talked up the "redonkulous" riders.
BMX (from bicycle motocross) made its Olympic debut four years ago in Beijing.
BMX bikes have only one gear and one brake, with 20-inch wheels that are about two-thirds the size of road bike wheels. It makes for some colourful action, with riders pumping their legs furiously and rocketing over bumps.
To the layman, it looks like a bunch of crazy risk-takers have snagged their little brothers' bikes to go racing over the most dangerous course they can find. If the producers of "Jackass" had decided to create the sport, they might have added attack dogs to the bottom of the banked turns, but otherwise the sport as is would be right up their alley.
Crazy but exciting.
There were stretchers placed around the outdoor course in the Olympic Park and it didn't take long to see why.
There were three crashes in the first four runs, with riders somersaulting over handlebars, or going down and getting run over. One crash, on a banked corner, saw seven of the eight riders go down in a tangle of bodies and bikes.
Amazingly the stretchers stayed where they were. And the riders showed remarkable powers of recovery, although Heat 1 was down to four riders for the final run with the withdrawal of Brazilian Renato Rezende and New Zealander Kurt Pickard.
Australian Khalen Young went down in a nasty solo crash in the first run. He ended up on his knees, face down, and took his time before getting up and gingerly walking off the course with an attentive volunteer at his side. He bounced back to finish second in his next heat and eventually qualified for the semis.
It's no wonder the key in the sport is a good start, from a gate at the top of an sharp eight-metre incline, so you can get clear of the possible carnage. Riders can be going as fast as 65 km/h after reaching the bottom of the start hill.
The course, which features jumps, bumps and banked corners, is 450 metres long for the men and 440 for the women.
Each run was akin to a 40-second demolition derby on bikes.
"Crashing is part of the sport," said Nyhaug. "It sucks when it happens but that's the way it is."
Nyhaug should know. He has seen limited action in recent months due to a mid-May crash in the Netherlands that left him with a cracked wrist and damaged spleen, and kept him in hospital for 11 days. He had his spleen removed after flying home.
Just getting to the Olympics was a victory.
"It definitely was," he said. "Anything else was extra but the racer in me wants to make it through the rounds. It just didn't happen today."
Nyhaug escaped unscathed in his first run here, finishing third.
But he went down hard next time out, unable to get around a rider in front of him who landed awkwardly. Nyhaug got up and finished seventh to stand sixth after two heats. Scrapes were the only damage, he said later.
Squeezed out wide on a corner in the third heat, he finished sixth to stand sixth overall.
After the first three runs, the top two in each of the four heats moved on to Friday's semifinal. The rest had two more runs, with the top two also advancing from each heat.
The Canadian placed third in the fourth run in a photo finish to move closer to the top two. In the last run, knowing it was all or nothing, he came out flying.
"I knew it was going to be close, I knew I had to beat some guys by two spots," he said. "I looked behind me and saw that Rihards Veide made it. Congratulations to him, and I wish him the best of luck."
After seeing Veide was second and realizing that his Olympics were over, Nyhaug hung his head as he sat on his bike.
"I felt really fast," he said. "I was in the mix the whole day. I just had a couple of bad motos (runs) where I got hung up on the outside with other guys. But that's BMX. You can't be upset about that. It's the sport and we all know that going in."
As he talked to the media, the six-foot-one, 192-pounder unzipped his blue tunic top to expose a bare chest under his neck guard. No protection.
Nyhaug was 20th in a solo qualifying run Wednesday after losing his line partway through the course. That put him lower down the ladder in choosing a gate for the opening quarter-final run.
Nyhaug is currently ranked 14th by the UCI, the world governing body of cycling, but has seen limited action since the crash.
He had been ranked as high as fifth in the world.
"It's impossible to know where I would have been ha I not got injured," said Nyhaug, who sent a shoutout to B2Ten, Own The Podium and the Canadian Cycling Association for helping get him ready for the Games. "But things happen and you can't go back an change it. You just have to accept it and move on."
The young rider seems to be enjoying his Olympics, tweeting a photo of him and Australian cycling star Anne Meares from the athletes village.
"I'll definitely never forget this experience," he said. "It was an awesome day of racing. I had a lot of fun."
The women's field of 16 had the day off Thursday but will join the men Friday in semifinal action. Canada does not have a female rider here.
Nyhaug will watch from the sidelines.
"BMX Supercross is always crazy," said the young Canadian. "This was probably the coolest race I've ever been a part of, so I'm going to remember it for ever."