The win was the Senators' first in four tries against the Bruins this season, and they were outscored 13-6 in the first three, including a humiliating 7-2 setback on Dec. 19, also at Scotiabank Place.
Mike Comrie, Daniel Alfredsson, Patrick Eaves and Peter Schaefer, into an empty net, also scored for the Senators, who trailed 2-0 after two periods before rallying to their seventh victory in their past nine games.
Alfredsson scored the winner at 12:25 of the third period as he jumped on a loose puck in the slot, spun and fired beating netminder Tim Thomas. Eaves gave the Senators an insurance goal with just over two minutes to play.
The Senators dominated the third period outshooting the Bruins 19-12 and 36-25 overall.
Comrie scored his first goal as a Senator at 2:22 of the third period, cutting the Bruins lead in half before Heatley tied the game 2-2, just over three minutes later.
Comrie grabbed a loose puck in the Bruins' end, cut in front of the net, and scored on a backhand after waiting just long enough for Thomas to get himself out of position.
Heatley put on a stick handling clinic as he skated in from centre through a maze of skaters and fired a wrist shot past Thomas on the short side.
Minutes later, the Senators caught a break as Bruins forward Marc Savard beat Ottawa goal Ray Emery with a long shot, but hit the post.
After a scoreless second period, the Bruins took their 2-0 lead into the third period. Not only was there no scoring in the second, but there wasn't much in the way of shots on goal either, as the Senators had six and the Bruins only three.
Sturm opened the scoring less than three minutes into the game converting a penalty shot after he was hauled down by Senators defenceman Andrej Meszaros while the Bruins were shorthanded.
Sturm moved in, stopped dead in front of Emery and picked the corner for his 11th goal of the season.
Mara gave the Bruins a 2-0 lead at 11:37 when his point shot seemed to catch Emery off guard as the puck went right through his legs.
Notes: - Senators defenceman Christoph Schubert played in his 100th NHL game Tuesday night ... The Senators are in New York to play the Rangers on Thursday night.