Miles Wood had a goal and an assist for the Devils (14-27-7), who held a 3-1 lead with 10:42 remaining. Mackenzie Blackwood made 33 saves.
New Jersey has not won since April 8. The first nine losses of the skid came in regulation. The Devils also had a 10-game skid (0-8-2) from Feb. 19 to March 11, 2017.
"I'm pretty confident there that that's one we should have won," New Jersey forward Nathan Bastian said. "In the last two minutes, up by two goals, you've got to find a way to close it out."
Philadelphia is sixth in the eight-team MassMutual East Division, nine points behind the fourth-place Boston Bruins. The top four teams will qualify for the Stanley Cup Playoffs.
It was the first of four consecutive games between the teams. They will play again at New Jersey on Tuesday.
Giroux's second goal gave him 850 points (270 goals, 580 assists), moving him one past
Brian Propp
for third in Flyers history. He trails Hockey Hall of Fame forwards
Bobby Clarke
(1,210 points) and
Bill Barber
(883).
"Brian Propp was a great player here," Giroux said. "Just being able to pass him, it's an honor. And being able to win this game makes that feels even better."
Elliott stopped Nico Hischier to clinch the win. Giroux and Couturier also scored in the shootout for the Flyers. Yegor Sharangovich and Jesper Bratt scored for the Devils.