Two nights earlier, the Flyers needed a miracle comeback — two goals with their goalie pulled in the waning minutes, and then a rare shootout win — to extend New Jersey’s losing streak to double digits.

On Tuesday, there was another Flyers rally, but no win this time.

And no more losing streak for the Devils.

New Jersey ended a 10-game skid, the second longest in the NHL this season, with a wild 6-4 win over the Flyers at the Prudential Center.

Just 11 seconds after Sean Couturier tied the game at 4, Yegor Sharangovich scored from out front with 7:24 remaining after goalie Brian “Moose” Elliott got caught behind the net and tried to scramble back into position. That put the Devils ahead to stay at 5-4.

“A miscommunication between the D and the goaltender,” coach Alain Vigneault said of the winning goal. “Unfortunate to give up that [after] the way we battled back.”

The Devils registered just their fifth home win all season; they are 5-17-3 at the Prudential Center.

The Flyers again failed to win two straight. They have just one two-game winning streak in the last six weeks.

Couturier appeared to have an empty net with two minutes left, but New Jersey defenseman Matt Tennyson prevented the puck from going past the goal line.

The Devils added a late empty-net goal.

“We need to be more ready from the start of the game, and be tougher to play [against] for a full game” said a frustrated Couturier, whose team allowed the first goal for the 17th time in the last 19 games and fell into a 3-0 hole. “We can’t be on and off. When we’re on, we’re one of the best teams, but we have to be more consistent.”

Connor Carrick went around defenseman Phil Myers and beat Elliott from the right circle with 11:56 left, giving New Jersey a 4-3 lead.

“One I’m sure Moose would like to have back,” Vigneault said.

Couturier then tied it with a shot from above the left circle, scoring his 15th goal and ninth in a third period.

Pavel Zacha (goal, assist), Ty Smith (two assists), and Jack Hughes (two assists), the No. 1 overall pick in the 2019 draft, also made important contributions for New Jersey.

» READ MORE: First-round pick Tyson Foerster wants to make a run at the Flyers next season | On the Fly

Myers scored from the high slot — his first goal of the season — to get the Flyers within 3-2 with 17:36 left in regulation. Seventy seconds later, Claude Giroux took a slick pass from Jake Voracek, made a couple of dekes, and slipped the puck through Mackenzie Blackwood’s legs to knot the score at 3.

That brought the Flyers all the way back from a 3-0 deficit.

On Sunday, Giroux scored two goals in the final 1:26 to send the game into overtime as the Flyers overcame a 3-1 deficit and won in a shootout.

How bad were the Flyers earlier in Tuesday’s game?

  • They had a four-minute power play in the first period and managed one shot on goal. One. (Giroux did hit the left post.)

  • They managed three shots in the opening period. They had one shot by a forward (Couturier). One.

  • They allowed the first goal for the eighth straight game. Oh, and the goal, a rebound by Nico Hischier with 1:15 left in the first, was scored on the Devils’ power play, which had been in a 1-for-25 funk.

  • New Jersey’s feeble power play scored on its first two tries (Hischier, Zacha) as the Flyers showed why they have the 30th-ranked penalty kill.

The only positive for the visitors in the first period: Defenseman Egor Zamula, making his NHL debut, had two shots and a block and was one of only a handful of Flyers who showed energy.

The squandered early four-minute play changed the game, Vigneault said.

“We totally lost momentum on that power play,” he said. “It wasn’t effective at all.”

Fifteen seconds after Miles Wood’s point drive got past a screened Elliott and gave New Jersey a 3-0 lead, the Flyers trimmed the deficit as Oskar Lindblom scored on a scramble in front with 14:31 left in the second period. Lindblom (eighth goal) ended a flurry in which the Flyers had three shots — as many as they had in the first 24-plus minutes.

Jackson Cates and Nolan Patrick had assists. Cates notched his first NHL point while playing in his third game, and Patrick collected just his third point in his last 20 games.

The Flyers are now 11-16-4 since the start of March, a collapse that has dropped them into sixth place and out of the playoff race. When March started, the Flyers had the best points percentage in the East Division.

The coaches’ jobs are all safe, general manager Chuck Fletcher said recently. That was supposed to put the onus on the players, but they have not responded.

Asked to comment on the state of the team last week, Dave Scott, the team’s chairman, declined through a spokesman and said he wouldn’t talk until after the season.