With little time to think, Sabres forward Marcus Foligno picked his spot just as he lined up to take his penalty shot.

"You don't want to stickhandle, so I was just trying to get a shot off," Foligno said. "I just thought, 'Get it over his glove."'

Foligno was on target.

He beat Canadiens goalie Mike Condon high on the glove side to put Buffalo up by two goals late in the second period in a topsy-turvy 6-4 win over Montreal on Friday night.

"It's a lot of pressure, but it's fun pressure, and it was great to score that one," said Foligno, who had two goals and an assist for a career-best three points.

Evander Kane scored twice, including an empty-netter, and the Sabres hung on after nearly squandering a 4-1 lead to snap a four-game skid and win for just the second time in 11 home games (2-7-2).

While the Sabres gave their home fans something to finally cheer about, frustration set in among the Canadiens players.

Defenceman P.K. Subban was upset by how Kane sealed the victory with 55 seconds left.

Ryan O'Reilly cleared the Sabres' zone by bouncing the puck high off the boards and up the left wing. The puck was headed directly to Subban before it struck linesman Brad Kovachik's skate and caromed back to Kane, who crossed the blue line and fired it into open net.

"If it doesn't hit him, it rolls right to me and I turn it up the ice," Subban said. "I'm just not sure what we're supposed to do in that situation. Are we supposed to smile and be happy after that and say, 'Thank you,' to the linesman? I don't think so. I'm a little disappointed."

Canadiens coach Michel Therrien refused to use the bad bounce as an excuse by noting the linesman is in play.

Therrien blamed the loss on too many defensive breakdowns.

"It's always when you're making the big mistakes, and it cost us the game," Therrien said. "We scored four goals, you allow a team 21 or 22 shots against, you should win those hockey games. And we didn't win tonight."

Alex Galchenyuk and rookie Sven Andrighetto scored two goals apiece for Montreal. The Canadiens had a three-game winning streak snapped and dropped to 1-5-1 in their past seven road games.

Montreal also lost ground in the Eastern Conference playoff race by dropping into 11th place after Carolina moved ahead of the Canadiens by earning a point in a 2-1 shootout loss to Pittsburgh.

The Canadiens, who had been off since a 4-2 win over Tampa Bay on Tuesday night, were beaten by a Sabres team that was playing on back-to-back nights following a 5-1 loss at Philadelphia.

Defence remains an issue for Buffalo, which has allowed 16 goals in its past three games, including a 7-4 loss to Florida on Tuesday night.

"It might not be the prettiest game, it certainly wasn't a Picasso, but this group fought hard," Sabres coach Dan Bylsma said.