Rosehill's tally finished off a stretch of three consecutive Philadelphia goals that put the Flyers in front 4-2 heading into the third period.
Toronto moved within one when James van Rimsdyk scored 6:14 into the final period, but Ilya Bryzgalov was perfect in goal the rest of the way and Luke Schenn clinched the win by scoring into an empty net with 17 seconds remaining.
The victory was Philadelphia's fourth in a row, marking its longest such streak of the season. Bryzgalov made 25 saves in what was the Flyers' first road win in six tries.
Philadelphia moved within two points of New Jersey and the New York Rangers for the eighth and final playoff spot in the Eastern Conference.
James Reimer allowed four goals on 30 shots for the Maple Leafs, who had won three straight.
Senate Democrats to pull all-nighter on climate change
Susan Sarandon 'very excited' about daughter's pregnancy