OTTAWA, Ontario (AP) — Robin Lehner always enjoys playing against his former team. Picking up a 4-3 shootout win over the Ottawa Senators on Thursday made it that much more enjoyable.

Lehner stopped two of three shooters in the shootout to improve to 6-0-3 against the Senators since being traded to the Sabres in 2015.

"We needed this win and it was a pretty fun game," said Lehner, who made 37 saves.

This was just the second game of the season to go to a shootout for the Sabres, with their last one on opening night.

Jacob Josefson scored the shootout winner for Buffalo, which was coming off a disappointing 5-1 loss to Calgary. The Flames and Ottawa will play Friday.

"I think our focus and the response we made tonight was a great response," Sabres coach Phil Housley said. "After having — I wouldn't say a poor effort in our building — with travel and coming out here, I liked the way we started.

"From top to bottom everyone contributed (Thursday), especially with our team everybody's got to be going and I thought everybody had a big part in the game."

Marco Scandella, Sam Reinhart and Scott Wilson scored in regulation for the Sabres.

With the win the Sabres, who sit last in the East, are just two points back of the Senators.

Ryan Dzingel led the way for the Senators in regulation with two goals, while Thomas Chabot scored his sixth of the season. Craig Anderson made 31 saves.

The Senators, who had a number of stellar chances, felt they deserved a better fate on this night.

"In the second and third, we threw everything at them except the kitchen sink and it didn't go in," Senators coach Guy Boucher said. "We couldn't come closer than we did. You have to give credit to the goaltender, he played terrific."

Trailing 3-2, the Sabres tied the game just 27 seconds into the third as Ryan O'Reilly found Wilson in front and he beat Anderson high.

The Senators had a number of chances to regain the lead, but Lehner either made the stop or had luck on his side.

Dzingel tied it at 1 just 36 seconds into the second period as he fired a shot from the slot, and then gave the Senators the lead with his 19th of the season three minutes later.

"I haven't had that much fun in a while," said Dzingel, who played alongside Matt Duchene and Mike Hoffman. "Just feeding off those guys and complimenting them and it clicked. ... Hopefully we can stick together."

Dzingel, who turns 26 on Friday, has been a bright spot in an otherwise disappointing season for the Senators.

"I've always personally believed he could be a 20-goal scorer with what he did last year," Boucher said. "It doesn't surprise me how well he's played. To score 20 goals is quite an accomplishment in this league, especially considering it's just his second season, and he needs just one more and I believe he'll accomplish the feat. He's a nice story this season for our team."

Buffalo was able to tie the game midway through the second as Reinhart jumped on a loose puck in front and scored off his backhand, but the Senators made it 3-2 as Chabot beat Lehner glove side.

"We needed a bounce-back game from last night," said Reinhart. "It was nice to gut that one out."

The Senators nearly made it 4-2 as shots from Dzingel and Hoffman slid across the goal line, but Benoit Pouliot was able to clear the puck before Ottawa got another chance.

"I saw it live, I saw it on the replay and I couldn't believe it," Duchene said. "At the start of the period, that probably goes in with the fresh ice, but end of the period it literally died right on the goal post. I haven't seen one that close, probably ever."

The Sabres opened the scoring at the 17-minute mark of the first as Scandella kept the puck in at the blue line, spun and put a shot through traffic past Anderson.

NOTES: Ottawa C Tom Pyatt returned to the lineup after missing Monday's game with the flu. ... LW Max McCormick and D Erik Burgdoerfer were healthy scratches for the Senators. ... Buffalo D Josh Gorges returned to the lineup after missing the last five games.