Mika Zibanejad scored on a rebound to make it 3-2 with 4:32 remaining in the third, and Andrew Copp tied it 3-3 with 4:20 left.
"It was a really good comeback by us in the third," Copp said. "It seems like there's a lot of belief. We feel like we are a really good team, so really good teams can come back in games like that. Even though we didn't get the extra point at the end, I think the confidence gained from the way we played the last two periods and to be able to come back from something like that is going to happen in the playoffs for sure."
Joel Farabee scored 44 seconds into the third to give Philadelphia a 3-0 lead, but Panarin cut it to 3-1 at 1:22 when he redirected a shot from Jacob Trouba.
"We had some good chances in the second period, a lot of good chances that didn't go in the net and their goalie played really well," Gallant said. "He made some real key saves and then in the third period, we finally got one and when you get one and you're down 3-0, it gives you a lot of boost, so it set them back a bit."
Cam York gave the Flyers a 1-0 lead at 5:54 of the first period with a shot from inside the left point after a face-off win by Nate Thompson, and Owen Tippett scored 50 seconds later at 6:44 with a shot from in close as he was falling to the ice to make it 2-0.
It was Tippett's first goal since he was acquired in a trade with the Florida Panthers for Claude Giroux on March 19.
"I thought 'Tipp' was, I don't know if it was the best game he's played for us, but probably had to be up there," Philadelphia coach Mike Yeo said. "The number of quality scoring chances he had, obviously, he had the big goal for us, and I liked his play away from the puck as well."