Both sides had one goal through the first two shootout rounds and Elias snapped the tie by faking out Sergei Bobrovsky and putting a shot under his left pad.
The Devils ended a three-game losing streak and handed the Flyers their first loss in three contests.
New Jersey overcame a two-goal deficit in the second period and had to score late in the third to again tie it.
Zac Rinaldo and Claude Giroux gave the Flyers a 2-0 lead with goals during the first half of the second period, Giroux scoring his eighth of the season and Rinaldo the first of his NHL career.
Zach Parise and Adam Henrique both tallied for New Jersey to tie it at 2-2 through two periods.
Johan Hedberg made 20 saves in the victory. Bobrovsky stopped 33-of-36 shots.
Megyn Kelly: Santa Claus and Jesus are both white men
Wisconsin business offering 'therapeutic cuddling' forced to close