As they say about power plays, it isn’t as much about the sheer number of goals — it’s the timing of when you score one.

The Bruins, finally, got one last night when they needed it most.

After failing on their first four power plays, and not looking too sharp doing it, the Bruins connected on Patrice Bergeron’s shot from the left hashmark at 7:52 of the third period, the key to a 3-1 victory over the Buffalo Sabres.

Anton Khudobin, in just his second start this season, was very good all night, stopping 25 shots — and getting his second win thanks to his mates’ late offense.

“We needed that goal,” Bruins coach Claude Julien said of the Bergeron score, his second of the season. “It came big at the right time. That’s what we’re trying to get out of our power play: timely goals.”

Milan Lucic (No. 3) capped the scoring with an empty-net score with 48.6 seconds left. Brad Marchand (No. 6), questionable to play after he missed the previous game with a shoulder injury, scored the opening goal in the second period.

Buffalo’s Tyler Ennis tied the game, 1-1, late in the period after a turnover and positional mistake by rookie defenseman Dougie Hamilton.

So although the Bruins were clearly the better team on the ice — with a 39-26 edge in shots — they found themselves in a tie game well into the third period.

But at 7:24, Buffalo defenseman Mike Weber was sent off for delay of game, and the B’s had their fifth man-up chance. On a faceoff in the Buffalo zone, the puck went back to Chris Bourque at left point. He sent the puck down low, wide left of the net, and it caromed hard off the end boards, perfectly to Bergeron.

His quick wrister beat Ryan Miller (36 saves), and the B’s had the lead — and, soon after, the two points.