Frans Nielsen also scored twice, Kyle Okposo had a goal and two assists, and Thomas Vanek had a pair of assists for the Islanders, who scored four straight goals after falling behind 3-1 with 8:02 left in the second.
Evgeni Nabokov stopped 31 shots, and Tavares added two assists as New York scored four power-play goals against the Bruins, who entered with the third-best penalty kill in the NHL.
Boston gave New York repeated opportunities, and the Islanders capitalized for their fourth straight road win.
The momentum dissolved quickly as Boston spent most of the final four minutes trying to kill penalties.
Okposo's power-play goal with three seconds left in the second period tied it 3-3. Tavares gave New York its first lead with a tough-angle wrist shot 32 seconds into the third.
Nielsen started the comeback on a one-timer from the slot with 3:30 left in the second to pull New York within 3-2, scoring his second power-play goal of the game. The Bruins were back at full-strength for all of three seconds before the Islanders went right back on the power play when Milan Lucic was called for cross-checking during the faceoff.
Boston killed that penalty, but gave New York another opportunity when a clearing attempt by goalie Tuukka Rask went over the glass for a delay-of-game penalty with 41 seconds left in the period.
Okposo's wrist shot just seconds before the horn sent the game into the third tied at 3-3. Tavares sealed the Islanders' win later in the period.
Bergeron's power-play goal with 7:27 left in the second gave Boston a 2-1 lead, which Chara added to 25 seconds later with a slap shot from the point. It was the 10th goal of the season for both Boston veterans.
Nielsen tied it with a power-play goal 5:56 into the second on a one-timer from the top of the right circle off a crossing pass from Tavares. The goal came just 24 seconds after Matt Bartkowski was called for holding.
NOTES: The Islanders finished 4-for-8 on the power play. ... Okposo, who assisted on Nielsen's first goal, extended his point streak to seven games. ... Reilly Smith assisted on Bergeron's goal, giving him 17 for the season. ... Chara returned after missing one game with an undisclosed injury.