Michalek's second goal of the game with 20.9 seconds left in the third helped the Ottawa Senators recover from blowing a two-goal lead and earn a 3-2 home win against Buffalo on Thursday.
Craig Anderson made 30 saves for the Senators, who improved to 4-1-1 in their past six games.
Buffalo (15-34-8) rallied from a two-goal deficit to tie the game at 2-2 on third-period goals by Tyler Ennis and Drew Stafford.
"We get a quick goal in the third to make it 2-0 and then I think maybe they turned up the intensity a little bit, and they started to play a little better," Anderson said. "We weathered it pretty good for the most part, and give them credit, they were able to get a couple of goals there, but we found a way to win, and at this point in the year that's all that matters."
Michalek scored the game-winner after taking a feed from Jason Spezza, his wrist shot from the left hash marks beating Sabres goalie Jhonas Enroth high to the blocker side.
"We kind of let up and they scored two goals," said Michalek, who will play for the Czech Republic in Sochi. "These games are the toughest to play because they have nothing to lose, and so we are happy we won."
Karlsson, who had a goal and an assist in the Senators' 5-4 shootout win against the St. Louis Blues on Tuesday, scored his 15th goal at 3:12 of the second period to put Ottawa up 1-0. He fired a wrist shot past Enroth into the top right corner from the top of the far side of the right faceoff circle.
Michalek, who also scored Tuesday, made it 2-0 with his ninth goal 10 seconds into the third period. He slipped behind Buffalo defenseman Jamie McBain to tip home a pass from Spezza on an odd-man rush off the opening faceoff in the third.
"I think we controlled the game from the start and just couldn't really put the puck behind the goalie, and they came back in the end and had us scrambling for a bit," said Karlsson, the Senators' second Olympian, "but we never stopped and just kept going, and it's nice to see [Michalek] scored some goals."
Ennis scored at 10:25 of the third period to pull Buffalo within one. Stafford drew the Sabres even at 2-2 at 15:46 with his 10th goal.
"I thought we worked really hard and we came back from two goals down there in the third period, so it was a really good third period from us, but unfortunately it wasn't enough for us," Enroth said.
Karlsson, who will make his first Olympic appearance for Sweden in Sochi, leads all NHL defensemen with 54 points.
Michalek's first goal was not the fastest to open a period in Ottawa franchise history. That mark is held by Alexandre Daigle, who scored seven seconds into the second period of a 3-3 tie against the New York Islanders on Jan. 22, 1995.
Stafford just failed to click with Ville Leino on the Sabres' best scoring chance of the first period near the 12-minute mark. Leino, who was a healthy scratch for Buffalo's previous two games, fed a pass to Stafford, who got tangled up with McBain as his tipped shot went wide of an open right side.
"Drew's been really good for us for the last month or so, and Tyler Ennis has been the same, but you can't win many games when you have two or three players going good," Sabres coach Ted Nolan said.
Enroth, who will play for Sweden in Sochi, stopped 33 shots for Buffalo, which lost its fourth in a row in its final game before the Olympic break.
"It's frustrating, definitely, so frustrating, but it should be shut down," said Sabres defenseman Henrik Tallinder, who will play for Sweden in Sochi. "Everything in front of our net should have been shut down. We're not quite there. We have to be there, and we're not, so we have a lot to work on."
Enroth and Tallinder will be joined in Sochi by two Sabres teammates, United States goalie Ryan Miller and Latvian center Zemgus Girgensons.
All six Olympians from both teams were introduced to the crowd at the end of the game along with Nolan, who will coach Latvia.
"It's a classy thing," Nolan said. "The players work extremely hard to get to the Olympics. I mean, the Olympics are not like just an ordinary tournament; it's probably the best tournament in the world."
Ottawa (26-21-11) will play its final game before the break Saturday at the Boston Bruins.
"We wanted the points," Karlsson said. "That's what we had played this game for and we just couldn't move on. We play a tough team on Saturday and it's the last game before the break and we're just going to focus on that try and get another two points."