The win came in the Flyers' first game following the trade of captain Peter Forsberg, who was making his debut with the Nashville Predators later Saturday.
The loss might be costly for the Rangers. Shanahan was knocked unconscious in the third period following a hard collision with Knuble. The veteran forward was taken to a hospital, and early reports from the team said he was "alert, awake and moving his extremities."
New York also played the final period without goalie Henrik Lundqvist, who injured his left shoulder making a save, and defenceman Marek Malik.
Upshall, part of the deal that sent Forsberg to the Predators during a home loss to Toronto on Thursday, scored on the Flyers' first shot against backup Stephen Valiquette to give Philadelphia a 4-2 lead 2:33 into the third period.
Dmitry Afanasenkov, stopped by Valiquette on a penalty shot, later scored to make it 5-2. Geoff Sanderson, whose shot hurt Lundqvist, R.J. Umberger and Simon Gagne also had goals. Antero Niittymaki made 40 saves.
Philadelphia, the NHL's worst team, is 3-1-1 in its last five and won for the first time this season with Forsberg out of the lineup (1-14-3).
The Rangers missed a chance to move up in the Eastern Conference playoff race. Marian Hossa, Petr Prucha, and Matt Cullen scored but New York's three-game winning streak was snapped.
Gagne made it 3-1 with his 31st goal of the season with 30.8 seconds left in the middle period.
Lundqvist, still smarting from Sanderson's hard shot off his left shoulder that hurt him 1:25 into the period, banged his stick in frustration. It marked only the third time in 14 games that Lundqvist allowed more than two goals.
Sanderson was the first Flyers player to get to Lundqvist. Despite a first period in which New York held a huge shots advantage and a 6-0 power-play edge, Sanderson gave the Flyers a 1-0 with 6:31 left in the first period.
Philadelphia led even though it was outshot 13-2.
Hossa tied it for New York 2:26 later by tipping rookie defenceman Daniel Girardi's shot between Niittymaki's pads. It was Girardi's first NHL point in 10 career games.
Another late-period goal restored Philadelphia's lead. Umberger got to a turnover in the neutral zone and went in alone on Lundqvist. His shot between the pads with 1:09 left in the frame was the Flyers' 12th short-handed goal of the season - second-best in the NHL - and the league-low second allowed by the Rangers.
Philadelphia started strong against the Rangers. Hard-hitting forwards Ben Eager and Todd Fedoruk took three roughing penalties in the first 6:20, and Mike Richards fought New York's Sean Avery midway through the period.
Notes: Flyers C Mike York, one game away from 500 played in the NHL, was a healthy scratch for the fourth time in five contests . . . New York's power play that clicked six times in nine chances the previous two games was 1-for-9 . . . Philadelphia, 2-3-1 against New York, has killed 36 of 38 short-handed situations against the Rangers.