The Sharks scored twice on the power play, giving them seven man-advantage goals in seven games after being shut out in their previous four.
"That's what happens when you put pucks on net," Kennedy said. "One of our focuses is getting to the net. You see a lot of teams scoring dirty goals, and that's what we have to start doing. Get goals around the blue there, and just keep working away."
Reilly Smith scored twice for the Bruins, who ended a scoring drought but extended their losing streak to three. Gregory Campbell and Torey Krug also scored.
"We scored some goals but the rest of our game wasn't very good," Bruins coach Claude Julien said. "After we took that 2-0 lead we kind of got loose and sloppy, and that gave them a chance to get back in the game."
Antti Niemi made 20 saves in winning his third straight. Tuukka Rask stopped 37 shots but lost to the Sharks for the first time in four games.
The Bruins hadn't scored more than two goals in a game since a 4-3 win over Columbus on Nov. 21. They scored twice in the first three minutes against the Sharks.
San Jose scored four goals in the second period to erase a 2-0 deficit. The Bruins also scored twice in the period, and the game was tied 4-4 entering the third.
"It was good getting a lead, and we're happy about that," Bruins center Patrice Bergeron said. "But it seemed like halfway through that first period everything started going in a negative way."
Kennedy redirected a shot from Matt Irwin that clanked off the crossbar and into the net just over three minutes into the final frame.
Wingels deflected a shot from Marc-Edouard Vlasic 27 seconds into the period, and then steered in another shot by Irwin.
Kennedy scored his first goal with a redirection over Rask's shoulder. Pavelski scored on a power play, punching the puck in off Rask's pads.
"Tonight was a good morale boost to fall behind and then come back and really have everybody contribute," Sharks coach Todd McLellan said. "It was a good thing for our team."
Smith scored his second goal by finding a space between Niemi and a defenseman after Carl Soderberg set him up with a pass. Torey Krug scored after taking a pass from Brad Marchand.
Smith scored less than 30 seconds into the game with a wide-open shot into the net off a feed from Bergeron.
Campbell scored after a back-handed pass from Daniel Paille.
NOTES: Bruins D Dennis Seidenberg ended a five-game point drought with an assist on Campbell's goal. ... Sharks C Logan Couture passed concussion tests before the game and was cleared to play. ... Rask was 3-0 with a 1.33 career GAA against the Sharks entering the game. ... The Bruins scored more than two goals for just the second time in 11 games after doing so eight times in the previous 12. ... Boston has allowed the first goal in 11 of 15 games. ... The Sharks scored four goals in a period for the second time. ... D Brendan Dillon recorded his first point with San Jose.