Two quickfire goals gave Belarus an advantage it would hold until the end as Glen Hanlon took the country to the knock-out stage for the third time.
Belarus booked its place in the World Championship quarter-finals for the first time since 2009 - and only the third time in its history - thanks to a 3-1 win over Latvia.
Two goals in 33 seconds in the first period gave the host nation a decisive grip on its game against Latvia, securing a top-four finish in Group B and leaving its Baltic rival in need of victory in its final game against Switzerland to match its march to the last eight of the Olympics. Otherwise Finland would make the quarter-finals.
The result, unsurprisingly, thrilled another big Minsk Arena crowd and sparked celebrations which look set to run late into the Belarusian night as 14,500 fans got ready to party.
However, not for the first time in this competition, there was some nerve-shredding drama for the home crowd before the festivities could get underway in earnest.
With just 36 seconds left Kaspars Daugavins believed he had tied it up - and put Latvia on the brink of a quarter-final place of its own - when he smashed home a shot from the top of the face-off circle as his team launched a desperate 6v4 storm in a bid to save them.
But Latvian delight was cut short as the officials ruled that Gints Meija had unfairly blocked goalie Kevin Lalande in his goal crease as the shot whistled in.
Lalande, who was at the heart of that decisive moment, said afterwards: "I saw Kaspars lining up to shoot and then my vision was completely blurred out, I didn't get a chance to see the replay yet but a trust the ref made the right call."
Latvia took a different view. Head coach Ted Nolan was far from happy.
"I couldn't tell even with the slow motion replay. I told my players I was proud of the way they played and they deserved a better fate," Nolan said.
Arturs Kulda, Latvia's goalscorer, was also unimpressed. "I don't know exactly what the rules say," he said, "but from what I saw there was a shot, it went into the net and for some reason it wasn't counted."
The rule was 471 and says:
471.4 "No goal shall be allowed if an attacking player stands or holds his stick in the goal crease when the puck enters the goal net."
471.6 "No goal shall be allowed if an attacking player initiates contact with the goalkeeper, incidental or otherwise, while the goalkeeper is in his goal crease and a goal is scored."
471.8 "No goal shall be allowed where an attacking player enters or takes a position within the goal crease, so as to obstruct the goalkeeper's vision and impair his ability to defend his goal net and a goal is scored."
Belarus head coach Glen Hanlon was not keen to dwell on that controversial moment. "The goal was not counted and we won the hockey game. Hallelujah. That's all I have to say," he said. Hanlon has now taken Belarus to the last eight on all three occasions that the country has made progess through this competition.
After that controversy a disillusioned Latvia was hit with a sucker punch: Sergei Kostitsyn fired into an empty net to seal the win for the jubilant hosts.
Earlier it had seemed that Belarus, which has previously had to battle from behind for each of its victories, would give Hanlon a more restful evening behind the bench after a quickfire double outburst in the ninth minute.
Geoff Platt opened the scoring, and leapt away in delight after his long range effort ripped over Edgars Masalskis' shoulder and into the top corner on 8:07. Masalskis had a clear view of the traveling puck, but was beaten for speed as it lasered into the net.
Platt's celebration was exuberant, and he said after the game: "It's an emotion that I don't think I've ever felt in my career, just because of the atmosphere and electricity in the building. It just runs through your veins and grabs a hold of you."
Worse was to follow for Latvia just 33 seconds later, and fittingly it was Mikhail Grabovski who got his fourth of the competition. Belarus' talisman turned a setback into a crisis for Latvia after blazing past Martins Cipulis and Guntis Galvins as if they weren't there before putting the puck upstairs. Shellshocked, Latvia took a time-out.
The delay did nothing to dissuade the home crowd from its belief that Belarus could score with every attack, and the excitement possibly affected Alexei Ugarov soon afterwards when he took on a difficult shot ahead of some easier options around Masalskis' net.
Latvia struggled to create much and even a power play late in the first period offered little more than a Ronalds Kenins shot wide after some good work from Mikelis Redlihs and Daugavins as Belarus tightened the defensive screws in a manner rarely seen previously in the tournament.
The second session saw both the penalty count and Latvia's offence rise from the doldrums. The first flashpoint came around Masalskis net: Belarusian D-man Kirill Gotovets barreled into the goalie as he chased down a rebound and several Latvians took exception to the challenge.
But the bigger intervention came as Latvia won an extended 5v3 power play and duly cashed in. Arturs Kulda, a defenceman who was previously regarded as a stay-at-home character, smashed in his fourth of the tournament with a one-timer through Lalande's five-hole off an Aleksandrs Nizivijs pass.
Gotovets, who was at the heart of one of the game's flashpoints, later reflected: "Both teams had a lot riding on this game so it was intense. There were a lot of emotions and tensions that came out in that period. That's why a lot of unnecessary penalties occurred."
The third period was tense and chances were at a premium. Cipulis on the power play found himself well placed to tie the game but he swiveled and shot into Lalande's pads at the near post.
Belarus had one further hurdle to negotiate. When Vladimir Denisov was sin-binned for delaying the game with just over two minutes left Latvia launched that 6v4 surge. But after the loss Nolan's team must now beat Switzerland tomorrow to book its place in the last eight for the first time since 2009.
If the Swiss, whose own hopes of progress are now over, get a win of any kind Finland will be the beneficiary, claiming fourth place and continuing in the tournament.
There are no such worries for Belarus, though. "It's a tremendous feeling," Lalande added. "I don't think I have the words to describe it right now. We did it for ourselves because we believed in this team, but we would never be where we are right now without the support of the fans, not just the ones in the arena but all the people in Minsk and across the country are right behind us. That's definitely a big push."