BOSTON (AP) San Jose's Patrick Marleau and Joe Thornton made Boston pay for a string of penalties.
They scored power-play goals just 25 seconds apart in the second period to put the Sharks ahead for good to beat the Bruins 5-4 on Tuesday night.
''You've got to win them all kinds of different ways,'' coach Peter DeBoer said. ''It probably wasn't what either coach predicted but we'll take the result. We found a way.''
Joe Pavelski got the scoring started 42 seconds into the game for the Sharks and had two assists. Melker Karlsson had a goal and an assist, also in the big second period when the Sharks capitalized on four straight penalties by Boston.
''It's good to see. We've been doing a lot of good things,'' said Marleau, whose goal gave him 999 career points. ''Finally it's starting to go in for us.''
The Sharks had enough offense to overcome two power plays by the Bruins, who failed to hang on after leading 2-1 and 3-2.
The Bruins fell to 2-6-1 at home, where they have yet to win consecutive games this season.
''We know that we're not all playing our best every night and we have to,'' said Brad Marchand, one of four different players with goals for the Bruins. ''If we're going to start putting a few wins together we have to have everyone going every night. We can't have any passengers at all. If we have one then it's enough to cost us a game and right now we have way too many.''
Loui Eriksson, Patrice Bergeron and Tyler Randell each scored for Boston. The Bruins pulled within 5-4 on Bergeron's power-play goal at 13:32 left to play but could not overcome their second-period mistakes.
''Sloppy tonight - sloppy. Really, that's the only word I can find right now,'' Boston coach Claude Julien said. ''We have to deal with certain things and I plan on dealing with internally, but certainly not going to start elaborating here.''
Tuukka Rask had 23 saves for Boston and Martin Jones stopped 25 shots for the Sharks.
Eriksson's goal 1:53 into the second put Boston up 3-2, the last lead the Bruins would hold. Karlsson tied it with a goal 5:56 into the period, then the Bruins committed four straight penalties and San Jose capitalized with power-play goals by Marleau and Thornton.
Boston was called for too many men on the ice late in a power play and San Jose took a 4-3 lead when Marleau scored on a rebound 8:56 into the second period. Julien challenged the call, saying Thornton interfered with Rask as Marleau got the puck behind him, but the goal was upheld.
Boston was at even strength for all of 11 seconds before Ryan Spooner was called for interference. The Sharks pounced quickly and took a 5-3 lead on Thornton's one-timer from the slot at 9:21.
Notes: Joonas Donskoi scored in the first period and Brent Burns had two assists for San Jose. ... Seidenberg played in his 700th game. Boston D Adam McQuaid played in his 300th game. ... Thornton, the former Bruins' captain, had a goal and an assist. Thornton has four goals and five assists in 12 games against Boston.