After squandering a 3-1 lead, the Sabres rallied for two goals in the span of 75 seconds to steal away a 5-4 overtime victory. D'Agostini sealed it by outracing a flat-footed Chara to a loose puck and scoring on a partial breakaway 22 seconds into the extra period.
Forcing the turnover at the Bruins' blue line, D'Agostini managed to shift the puck from his forehand to his backhand and slip a shot in under Chad Johnson's pad.
''I could tell (Chara) didn't know I'd be coming up from behind him. I think he just thought he had time to go back and retrieve the puck,'' D'Agostini said. ''I heard their bench screaming. I tried a little sneak attack on him in there, so it was good that I got by him.''
Matt Moulson forced overtime by scoring with 53 seconds left in regulation. Brian Flynn had a goal and assist, while Tyler Myers and Zemgus Girgensons also scored for Buffalo.
It was a big win for Sabres backup goalie Jhonas Enroth, who stopped 29 shots and snapped an 0-10-4 skid to improve to 2-12-5 this season.
''That felt very nice to get a win finally again,'' said Enroth, who also won for the first time in 12 home starts, dating to a 3-1 victory over Tampa Bay on April 14 of last season. ''I've had these kind of games go against me, so it was nice to have one of these for me.''
Chara, Milan Lucic, Brad Marchand and Chris Kelly scored for the Bruins (37-16-5) in their first game after the NHL's two-week Olympic break.
The Sabres (17-34-8) at least had the benefit of having opened the break with a 3-2 win over Carolina on Tuesday night.
The Bruins had been off since a 7-2 win against Ottawa on Feb. 8, and featured five players - including Chara - still dealing with the effects of jetlag after competing at the Sochi Games.
''I thought offensively, I didn't mind our game,'' Bruins coach Claude Julien said. ''You score four goals, you should win those kind of games. But certainly, we were definitely rusty defensively.''
That was particularly the case on D'Agostini's goal.
''I think (Chara) was surprised,'' Julien said. ''But definitely we should have that puck.''
Boston is still 8-1-3 in its past 12, and hasn't lost in regulation in seven straight road games (4-0-3).
The game featured several swings of momentum, with Buffalo building a 3-1 lead when Flynn scored 9:10 into the second period.
The Bruins stormed back.
Chara scored 2:25 later by stuffing in a rebound for a power-play goal during a scramble in front. Marchand then tied it at 3 with 2:14 left in the frame, and was set up by teammate Reilly Smith, who stripped the puck from Buffalo forward-turned-defenseman John Scott in the right corner.
Boston then appeared to take control when Lucic made it 4-3 by scoring a power-play goal with 10:17 left.
The Sabres responded with Moulson's goal.
With Enroth pulled for an extra attacker, Moulson got the puck in the right corner of the Bruins' end. In attempting to feed a pass to Drew Stafford in front, the puck hit off the skate of Bruins defenseman Johnny Boychuk. Moulson got to the loose puck and stuffed it in.
''It's tough to not get that feeling of, 'It's the Boston Bruins, they're back in the game now,''' D'Agostini said. ''But we kept playing. We defended. We got big saves from Jhonas, which was huge, and we ended up gutting one out.''
Enroth got the start a day after Ryan Miller made 36 saves and also added two assists against Carolina. Enroth, who returned to Buffalo on Monday, was backup to Sweden starter Henrik Lundqvist at Sochi.
Buffalo won consecutive games for only the third time this season, and first since Dec. 17-19.
NOTES: Sabres C Tyler Ennis did not play due to undisclosed soreness. ... By scoring the winner against Carolina with 44 seconds left, Christian Ehrhoff became the Sabres' first defenseman to score the go-ahead goal in the final minute of the third period. ... The Bruins went with Johnson, who stopped 21 shots. Johnson started in place of Tuukka Rask, who remained in Boston to refresh after returning from Sochi, where he helped Finland beat the United States for the bronze medal Saturday.