Christian Ehrhoff and the Buffalo Sabres haven't had much success this season, but they can claim one thing: They know how to beat the Boston Bruins.

Ehrhoff scored the game-winner with 10:58 remaining and the Sabres rallied for three goals in the third period of a 4-2 victory over the Bruins on Friday night.

Both of the Bruins' losses in regulation have come against Buffalo (6-8-1). The Sabres, who have won only four of their last 13 games, also won 7-4 in Boston on Jan. 31.

"They are a great hockey team," said Ehrhoff, who also assisted on Cody Hodgson's insurance goal with 8:15 left. "We were the better team in the third. As much as they outplayed us in the first couple of periods, we came out and played our game and turned the game around."

Ehrhoff fired a wrister from the slot over goalie Anton Khudobin, who anticipated a low shot and went down early. Hodgson scored less than 3 minutes later when he tipped in a pass from Tyler Myers.

Myers began the comeback 2 minutes into the third period, tying the game at 2 by backhanding in a rebound after Khudobin stoned Jochen Hecht on a 2-on-1 break.

The goals completed a stirring comeback for Buffalo, which trailed 2-1 going into the third. Entering the game, Boston (8-2-2) had outscored its opponents 15-5 in the final period this season.

"We got a couple of good shifts in early in the third period," Ehrhoff said. "We rode from there, like a snowball effect. Everybody seemed to make plays all of a sudden that weren't working in the second."

Buffalo goalie Ryan Miller described the importance of beating Boston, one of the front-runners in the Eastern Conference race.

"It's important for us to get points, but we recognize the rivalry and I know the guys recognize this as a measuring stick," said Miller, who made 30 saves. "We go on the ice, we want to prove we belong."

Drew Stafford also scored for Buffalo, which snapped a two-game skid and won for the third time in eight games.

Dougie Hamilton scored his first NHL goal and added an assist for Boston, which failed to earn a point for only the second time in 12 games. Rich Peverley also scored for the Bruins. Khudobin stopped 22 shots.

Stafford opened the scoring 3½ minutes in, breaking his 17-game stretch without a goal. He connected on a one-timer from the slot after a sharp feed from Tyler Ennis behind the net.

Hamilton connected on a slap shot from just above the right circle during a power play. Miller was caught out of position about 10 seconds earlier and was still wandering around the net when Hamilton got the puck to convert his chance, becoming the first 19-year-old Bruins defenseman to score a goal since Jonathan Girard in 1999.

The rookie also accomplished it with a large number of family members and friends in attendance. Hamilton grew up in suburban Toronto — about a 90-minute drive from Buffalo — and played his junior hockey for Niagara about 40 minutes away.

"To be able to do it in front of friends, and most importantly my parents, is a special feeling," Hamilton said. "I wish it came in a winning game."

Hamilton assisted on Peverley's goal 2:29 into the second period, firing a shot off the back boards. A fortuitous bounce sent the puck directly to Peverley in the slot and he beat Miller on the stick side.

"A lot of shooting lanes are taken away, so we have to use the back boards once in a while," Boston coach Claude Julien said. "We got a nice bounce on that, and guys were in the right position to jump on it and capitalize on it."

With 8:15 left in the second period — during which Boston outshot Buffalo 17-6 — Miller was sharp on back-to-back saves, first stopping a long shot by Chris Bourque before foiling Tyler Seguin on a rebound from in close.

NOTES: Boston went 1 for 2 on the power play after entering the game with the worst power play in the league. ... Sabres D Andrej Sekera left the game with 10:16 to play after absorbing a check in the corner from Scott Thornton. Buffalo coach Lindy Ruff described the injury as a charley horse and said Sekera would miss "a little bit of time." ... Buffalo outshot the Bruins 10-3 in the third period.