Vatrano tied it 2-2 at 11:59, poking in a shot from McTavish that squeaked past Luukkonen.
He then completed a 2-on-1 with McTavish at 14:34 to put the Ducks ahead 3-2.
Zach Benson deflected Henri Jokiharju's shot to tie it 3-3 at 15:20.
Terry's shot went under Luukkonen's left arm and trickled into the net for a 4-3 Anaheim lead at 18:56.
"I just kind of got it low and, kind of ran out of space," Terry said, "so I just tried to make a quick move out and just get it on net. I think it went under his arm or something. It's just one of those goals. Sometimes you put one on the corner, and you think it's for sure going in and then the goalie makes a good save. That was just an in-tight goal that just happened to find a way through."
Buffalo pushed for the tying goal in the third period, outshooting Anaheim 10-2. Gibson got a piece of JJ Peterka's shot on a breakaway at 6:24 and later stretched out his glove to hold onto a Thompson's attempt on the doorstep at 11:39.
Thompson had nine shot attempts, including four on goal.
"Tage, he's doing the right things," Sabres coach Don Granato said. "I think probably in his own head a little bit pressing. Evident on the breakaway, the chances he had … I think if he's feeling it, he's probably elevating it over the glove."
NOTES: McTavish (136 games) became the fifth-fastest player in Ducks history to reach 80 NHL points, behind Paul Kariya (80 games), Bobby Ryan (105), Trevor Zegras (108) and Ryan Getzlaf (121). … Terry's 11th three-point game tied Jakob Silfverberg and Scott Niedermayer for ninth in Anaheim history. … The Sabres recalled defenseman Kale Clague and goalie Dustin Tokarski from Rochester of the American Hockey League before the game. Tokarski backed up Luukkonen in place of Eric Comrie, who was scratched with an illness. … Referee Kevin Pollock left in the first period and did not return after he was injured when Greenway accidentally slid into him in the corner. The remainder of the game was played with one referee and two linespersons.