GettyImages-1747335506

BOSTON -- Mason McTavish scored 2:08 into overtime, and the Anaheim Ducks rallied late to hand the Boston Bruins their first loss of the season, 4-3 at TD Garden on Thursday.

McTavish completed a 2-on-1 rush with Leo Carlsson to win it.

The Ducks trailed 3-1 late in the third period before tying it with back-to-back goals in the final 1:55. Carlsson cut it to 3-2 at 18:05 after a long offensive zone possession with goalie John Gibson pulled for the extra attacker, and Troy Terry tied it 3-3 with 15 seconds left with a deflection on the doorstep.

It marked the first time in franchise history that Anaheim won after trailing by multiple goals in the final 2:00.

“It was a great win,” McTavish said. “You don’t see two [goals with the extra attacker] often in an NHL game. It’s nice to tie it up, and we took advantage of it in overtime.”

Carlsson and Terry also each had an assist, and Radko Gudas scored his first goal for Anaheim (3-4-0). Gibson made 27 saves.

David Pastrnak had a goal and an assist, Charlie Coyle scored, and Charlie McAvoy had three assists for the Bruins (6-0-1), who nearly set a new franchise record for wins to begin a season at seven. Linus Ullmark made 28 saves.

“It’s tough,” said Boston defenseman Matt Grzelcyk, who scored his first goal of the season. “You got to find a way to close that out, and a little bit of history on the line there, and we knew that going into the game, and it’s just unfortunate. We could have found a way to get a clear, and they did a good job getting bodies there to the net and making it tough on [Ullmark].”

Gudas gave the Ducks a 1-0 lead at 15:00 of the first period with a shot from long range that bounced in off the skate of Bruins defenseman Hampus Lindholm. Boston challenged for goaltender interference with McTavish screening Ullmark on the play, but the call stood upon video review.

Gudas signed a three-year, $12 million contract on July 1.

“We tried to work them down low,” Anaheim forward Trevor Zegras said. “Obviously get pucks in deep early, kind of get their [defensemen] backing off the blue line so we can start to make those plays, and like I said, just compete, work hard.”

The Bruins responded by scoring twice in a 1:20 span early in the second period.

Coyle tied it 1-1 at 1:41 of the second period on the power play, knocking in a centering pass from Pastrnak. Grzelcyk gave the Bruins a 2-1 lead at 3:01, scoring past Gibson from the right circle during a 4-on-4.

“It doesn’t matter how many goals you’re up, you’re never that safe,” Coyle said. “You can’t get complacent, and you want to always be in attack mode and do it the right way.”

Pastrnak extended it to 3-1 at 16:40, following up his own shot from the left circle and chipping in the loose puck at the net front.

While on the penalty kill at 7:19 of the second, Bruins forward John Beecher nearly scored his first NHL goal on a 3-on-2 rush, but missed the open net with a shot off the post. The play represented one of multiple missed opportunities for Boston to put the game further out of reach.

“I thought the game was over twice,” Bruins coach Jim Montgomery said. “We could have extended our lead to four or five [goals]. We had many opportunities to do it, and we didn’t finish the game. So, you couple those things together, it’s inexcusable. You can’t be up 3-1 with five minutes left and end up tied and going to overtime.”

The game had added meaning for Ducks coach Greg Cronin, who is from Arlington, Mass, and has both coaching and personal ties to the Boston area.

“I’ve been here a lot,” Cronin said. “I kind of had a moment on the bench in the first period thinking, you know, ‘I’m the head coach in the Garden.’ … Some of those memories [at TD Garden in the past] flashed through, but like I said, I just kind of focus on the game and what’s at hand for me as a coach.”

NOTES: Carlsson (18 years, 304 days) became the third-youngest player in franchise history with a multipoint game behind Oleg Tverdovsky (18 years, 250 days; three assists on Jan. 23, 1995) and McTavish (18 years, 256 days; one goal and one assist on Oct. 13, 2021). … The Ducks ended Boston’s 14-game regular-season win streak dating back to Mar. 30 last season. … Matthew Poitras had one assist to extend his point streak (three goals, one assist) to three games and became the first teenager since McAvoy (four games and three games in 2017-18) to record a streak of that length for the Bruins.