D'Agostini eluded Bruins captain Zdeno Chara and broke in on goalie Chad Johnson after forward Loui Eriksson turned over the puck out of the zone. D'Agostini slipped the puck underneath Johnson's right leg to give the Sabres their second win in as many nights.
"Once I saw the puck go out, I could tell [Chara] didn't know I'd be coming up from behind him," D'Agostini said. "I think he just thought he had time to go back and retrieve the puck. I kind of just snuck up behind him. I heard their bench screaming. I tried a little sneak attack on him in there, so it was good that I got by him and snuck it through the pad."
The Sabres got to overtime when Matt Moulson tied the game with 53 seconds left in the third period with his 16th goal of the season. Moulson pounced on a rebound of a Zemgus Girgensons shot and slipped the puck underneath Johnson.
"It was a bit of a lucky bounce," Moulson said. "I was actually trying to get it to [Drew Stafford] and it hit one of their guys' skates, came right back to me and off the post, off the goalie and in. I felt a little bad for taking that penalty in the end and them getting a goal. It's good to get that one tied up and get the win for [Jhonas Enroth]."
Moulson put the Sabres in a hole when he was whistled for a double-minor high-sticking 9:11 into the third period. Milan Lucic gave the Bruins a 4-3 lead 32 seconds later when he ripped a slap shot from the slot to beat Enroth for his 18th of the season. Enroth was scrambling after the Bruins buzzed his net, and Torey Krug connected with Lucic out high for the open look and shot.
"When things like that happen, [Moulson] didn't really mean to do it, it was unfortunate," Sabres coach Ted Nolan said. "I'm quite sure he felt bad they had the go-ahead goal, but I'm quite sure he's very happy he got the equalizer."
Enroth stopped 29 shots playing instead of Ryan Miller, who was in net for a 3-2 win against the Carolina Hurricanes on Tuesday. It was Enroth's second victory of the season, first since Oct. 25 against the Florida Panthers, in his 19th start.
"I guess it hasn't been a good season for anyone in here, I think," Enroth said. "But, finally we start getting some luck and getting some bounces. It feels nice to win finally."
Buffalo took a 1-0 lead when Girgensons scored 3:32 into the first period. He was parked in front of the net when Brian Flynn connected with him on a centering pass from the corner. Girgensons' shot squeezed through Johnson for his sixth goal of the season.
Bruins forward Chris Kelly tied the game at 10:47 of the first with his fifth goal of the season. Kelly was set up in the faceoff circle to the right of Enroth when Carl Soderberg passed to him from behind the net. Kelly's shot beat Enroth over his right shoulder.
The Sabres held a 3-1 lead in the second period after a power-play goal from Tyler Myers at 6:25 and a wrist shot from Flynn at 9:10. Myers' goal came after he drew a slashing penalty against Bruins forward Brad Marchand.
"It always feels nice to score goals," Flynn said. "That's why you play the game. It's fun. It's nice to chip in there. Goals are tough to come by, so anytime you get one it gives you a little more confidence."
The Bruins came back late in the second. Chara scored a power-play goal at 11:01, his ninth on the man-advantage this season. Marchand scored his 20th of the season to make it 3-3 with 2:14 remaining. He took a pass from Reilly Smith after the forward stole the puck from Sabres defenseman John Scott.
"We did a really good job battling back from that two-goal deficit," Marchand said. "They played really well. They played hard. It would've been really nice to get two points."
Johnson made 21 saves playing instead of Tuukka Rask, who was given the night off in the Bruins' first game after he played for Finland at the 2014 Sochi Olympics.
"I think we're a team that expects more and to me we should have walked out of here with a win," Bruins coach Claude Julien said. "We had the game under control and then we gave them that tying goal and that's our own mistakes, even on that winning goal, not getting back quick enough.
"So you've got to look at yourself and say we had the game under control with a little over a minute left, or less than a minute left, and we gave them that first point and gave them that second one."