The Flyers, perhaps energized knowing they have a rare three-day break before their next game, dominated the first two periods Sunday at the Wells Fargo Center.

They outhustled the Islanders, won a majority of the board battles, and spent most of the first 40 minutes in New York’s end.

But Isles goalie Ilya Sorokin was the great equalizer, and, in the end, his strong play and a fluke goal were the difference as the Islanders jolted the Flyers in overtime, 1-0.

With 2 minutes, 37 seconds left in overtime, the Isles won it when Nick Leddy’s pass deflected off Travis Sanheim’s stick and through the legs of goalie Brian Elliott, who had no chance.

Before the crazy ending, Sanheim had played perhaps his best game of the season.

“I had a lot of jump tonight, but unfortunately couldn’t capitalize, and ended up putting it in my own net,” said Sanheim, who had five shots in 23:08. “So that’s the night.”

“We blocked shots and did all the right things we talk about in the locker room,” Elliott said. “That’s what makes this game so tough.”

» READ MORE: Oskar Lindblom, cancer survivor, saluted before Flyers face Islanders

Elliott (27 saves) was brilliant in defeat.

“Been a tough year, and we can’t find a way to win even though we played pretty well,” Oskar Lindblom said.

Lindblom was saluted before the game on Hockey Fights Cancer Night. “Something I’ll never forget,” he said.

“I think that’s the reason we had so much jump tonight,” Sanheim said of the pregame salute to Lindblom, who has overcome a rare bone cancer.

The Flyers played their fifth game in eight days.

“We’re running on fumes,” Alain Vigneault said.

The Flyers killed penalties to Kevin Hayes (hooking) and Wade Allison (holding) early in the third. On that latter penalty, Sorokin stopped Sean Couturier on a shorthanded breakaway with 12:28 left in regulation.

Even though the Isles didn’t score, Vigneault said the penalties, which he thought were not justified, gave them momentum.

“With all the time we spent in their zone, in my own personal opinion, to get those two average calls against us that they had let go in the first two periods there, it just wasn’t right,” he said. “And they were able to get momentum off of it and a little more energy and a little more speed.”

Elliott kept the Islanders off the scoreboard when he denied Casey Cizikas from point-blank range with a little over eight minutes left. Elliott, as he was falling down, then robbed Kyle Palmieri from the slot after a loose puck pinballed to him with 7:11 remaining.

» READ MORE: Did COVID-19 contribute to Flyers’ downfall? We may never know | Sam Carchidi

The Islanders controlled the third period and outshot the Flyers, 13-6, but Elliott stood tall.

The teams reached overtime in six of their eight meetings this year.

Early in the second, the Flyers failed to capitalize on the game’s first power play, and, shortly after the Islanders went back to full strength, Elliott stopped Cizikas on a two-on-one chance, keeping the game scoreless with 16:09 to go in the period.

“Moose” chants echoed around the Wells Fargo Center.

Sorokin stopped Hayes (five shots) and Allison from the doorstep later in the period, so the teams were still 0-0.

The Flyers had a 23-13 shots advantage after the first two periods, and they had a 46-24 domination in shot attempts.

“The first and second periods, we had some real good looks, and their goaltender made some real big saves at the right time,” Vigneault said. “We had enough looks to get a couple, and we didn’t.”

The Flyers controlled the first period against the surprisingly disorganized Islanders, even more than their 8-4 shots advantage might suggest. But they couldn’t convert some odd-man rushes, and had 13 shots that were either blocked or missed the net.

In other words, they showed why they have struggled offensively over the last month. They had averaged 2.2 goals in their last 16 games before Sunday.

Sorokin, 25, a rookie who is having an outstanding season, has looked like Billy Smith in his prime against the Flyers this season. He entered the night 4-0-1 with a 1.89 GAA and .933 save percentage against the Flyers.

Sorokin was the best player in the opening 20 minutes, and, because of him, the Flyers failed to carry a lead into the second period for the 17th time in their last 19 games.

The Islanders won the last five meetings against the Flyers this year and moved past Pittsburgh and into second place in the East Division.

The Flyers are now nine points behind surging Boston for the East’s final playoff spot. Philly has gone 9-14-4 since the start of March, and with just 11 games left, time is running out.