It was Sanheim's first goal, with two seconds remaining in the second period, that turned the game. He took a pass from Justin Braun and scored from above the right hash marks to tie the game 1-1.
"No doubt that goal at the end of the second period, momentum-wise, energy-wise, gave us a boost," Philadelphia coach Alain Vigneault said. "I can't speak for them, but it probably hurt them a little bit."
The Rangers outshot the Flyers 14-7 in the second and led 1-0 on Fast's shorthanded goal at 6:44.
"We should be going in 1-0, and then we give up a goal with [two seconds] left in the second period, then give up five unanswered goals," forward Chris Kreider said.