Manny Malhotra, Ryane Clowe and Patrick Marleau also scored for the Sharks, who are 7-0-2 at home.
Claude Giroux scored twice and Danny Briere added a goal for the Flyers, who lost for the second time in nine games.
Thornton, who had points on each of Heatley's goals, earned four assists. He matched his franchise record, and has 30 points this season.
Heatley notched his second hat trick of the season, and the ninth of his career.
Giroux had his first career multigoal game.