It was the first time Bergenheim scored since March 20, 2012. He missed last season due to injury and was playing his 10th game this season.
Erik Gudbranson also scored for Florida, his first of the season.
Wayne Simmonds scored for the Flyers, and Steve Mason stopped 28 shots.
The Panthers have won three of their past five games and evened the season series against the Flyers at a game apiece.
Philadelphia lost for the first time in four games and the second time in their past eight. The Flyers failed to get a point for the first time in eight games.
The Panthers stretched their lead to 3-1 on Gudbranson's fluky goal with just over 4 minutes left. Gudbranson took a shot from the point that bounced over Mason's shoulder at 15:56.
The Flyers closed to 2-1 on Simmonds' power-play goal at 7:06 of the third. Thomas stopped a shot by Scott Hartnell, but Simmonds got control of the rebound near the crease and wristed it past Thomas.
Florida took a 1-0 lead in the second on Bergenheim's first goal. The puck was bouncing around the Flyers' net and Bergenheim had several attempts from behind. He stayed with it and finally slid in the puck with a wraparound on the short side at 3:35.
The Panthers had killed off a power play moments earlier that included a 5-on-3 for 1:23.
Florida went ahead 2-0 on Bergenheim's second goal during a power play. Marcel Goc took a shot from the top of the left circle and Bergenheim tipped it past Mason on the glove side at 13:59 of the second. It was the first power-play goal for the Panthers in their last 10 attempts over three games.
NOTES: The Panthers placed RW Tomas Kopecky on injured reserve, retroactive to last Friday, with an upper-body injury. He is expected to miss two games. ... Panthers D Matt Gilroy also is on injured reserve and is expected to miss at least three games with a lower-body injury. ... Florida named its press box in memory of its first coach, the late Roger Neilson. ... The Flyers began a stretch in which they will play nine of 11 games on the road.