With the score tied 1-1 early in the second period, Hartnell put the Flyers ahead for good when he dove to poke in the rebound of his own shot during a power play.
Jagr -- the NHL's active career scoring leader -- notched his first two goals since returning to the NHL from Russia after signing a 1-year contract with Philadelphia during the off-season.
Hartnell added an assist and Sergei Bobrovsky turned aside 24-of-26 shots for the Flyers, who bounced the Maple Leafs for the ninth time in 11 meetings.
Gustavsson finished with 26 saves.
Flyers defenseman and team captain Chris Pronger left in the first period after getting hit with a high stick and didn't return.