The Flyers had won 29 of their previous 33 games against the Islanders, including a 7-0 victory earlier this season.
Colin McDonald's second goal of the third period, a drive that appeared to deflect off defenseman Bruno Gervais, snapped a 2-2 tie with 4 minutes, 23 seconds left.
But on a six-on-four power play with their goalie pulled, the Flyers tied it in the final minute. Hartnell scored after a mad scramble in front.
The ever-popular faceoff violation gave the Flyers an extra skater.
The Islanders had tied it at 2 when McDonald scored from deep inside the left circle with 9:56 remaining in regulation. McDonald was given tons of space as he scored his fifth goal of the season.
"We got running around and weren't taking care of the puck," winger Mike Knuble said.
The Flyers, who began the night 14th in the Eastern Conference, have been outscored, 38-22, in the third period this season.
Hartnell scored on a flubbed shot - a knuckleball that had him smiling and rolling his eyes after it eluded goalie Evgeni Nabokov while the Flyers were on an early power play - for just his third goal of the season.
It made the Flyers 3 for 3 on the power play in their last three games.
The Flyers have struggled mightily recently, but their power play had moved to No. 3 in the 30-team NHL with a 23 percent success rate entering the night.
Knuble, a healthy scratch in the previous eight games, made it 2-0 by scoring on a backhander as Claude Giroux sent him in alone against a sprawling Nabokov with 2:35 left in the first period.
But the Flyers couldn't finish it off. Despite blowing the lead, they inched to within six points of the eighth-place New York Rangers, who lost in Ottawa.
"You show up and you play for your teammates. It doesn't matter what the standings are," Knuble said after depositing his 277th career goal and third in 19 games this season. "It's quite the task, but as long as there's a chance until the math eliminates you, then you keep going."
The Isles, who are tied with the Rangers but have played one more game, cut it to 2-1 with a minute left in the second period as John Tavares' backhander deflected off the skates of two Flyers defensemen - Luke Schenn and Erik Gustafsson - and went into the net.
The Flyers lost the services of defenseman Braydon Coburn to an upper-body injury in the second period. They already were missing injured defensemen Nick Grossmann and Andrej Meszaros.
Contact Sam Carchidi at email@example.com. Follow on Twitter@BroadStBull.