Voracek scored from behind the goal line as his centering pass caromed off goalie Tomas Vokoun and into the net with 1 minute, 31 seconds remaining.
It was the first hat trick of Voracek's career. He was coming off a four-assist game against the Islanders.
"I was just trying to throw it at the net so someone could get a rebound," Voracek said of his winning goal. "But it took a lucky bounce, and I'll take it."
The Penguins had tied it 32 seconds earlier on Brandon Sutter's wraparound.
It marked the fifth time (twice in the playoffs) in the last two seasons the Flyers had overcome a two-goal deficit to defeat the Penguins.
"You're sitting on the edge of your seat, that's for sure," Wayne Simmonds said of the high-scoring rivalry. "It seems we always go down early and storm back, and then it's shot for shot after that. It's obviously not what we drew up, but it's definitely nice to get the win."
Voracek scored on a power-play rebound with 9.9 seconds left in the second period to put the Flyers ahead, 3-2. Simmonds (two goals) helped set up the goal, giving him a Gordie Howe hat trick - a fight, a goal, and an assist.
Eighteen seconds into the third period, Voracek increased the lead to 4-2, giving him two goals in 28 seconds. Pittsburgh pulled to within 4-3 as Tyler Kennedy scored on a rebound with 14:31 to play, but Simmonds' pass deflected off defenseman Matt Niskanen and into the net to give the Flyers a 5-3 lead.
The Penguins got to within 5-4 on James Neal's five-on-three power play goal, but Chris Kunitz's five-on-three goal was nullified because he kicked the puck into the net with 5:39 to go.
The Flyers lost the services of their leading goal scorer, topline winger Matt Read, to an upper-body injury in the first period. Read was hit by Kunitz late in the first period, and the Flyers juggled their lines the rest of the way.
The win, coming on the heels of a 7-0 romp over the New York Islanders, enabled the Flyers to end their six-game road trip with a 3-3 record. They are 6-1 in the regular season at the Consol Energy Center since it opened.
Pittsburgh, which allowed 30 goals while losing a six-game playoff series to the Flyers last season, dominated the first part of the opening period, building a 2-0 lead and outshooting the visitors, 12-2. Along the way, Evgeni Malkin ended the Flyers' streak of 21 straight penalty kills with a power-play goal.
But the Flyers regrouped and got goals from Nick Grossmann and Simmonds to knot the score at 2. They outshot the Penguins, 13-1, in the latter stages of the first period.
Grossmann scored during a scramble in which Vokoun was flat on the ice, a half-dozen players converged in the crease, and defenseman Kris Letang was inside the net. It was the Flyers' sixth shot in the sequence and was the defenseman's first goal in 151 games.
Simmonds, on an assist from Danny Briere, scored on a pretty move in front.
"I yelled for Danny as he was about to shoot it," said Simmonds, who earlier in the period was in a lively fight with Tanner Glass. "He found me down low, and I just kind of walked the puck to the net."
The Flyers survived because they kept Sidney Crosby's line, which had been sizzling, to a combined one point and a minus-9 rating.
After the morning skate, Flyers defenseman Kimmo Timonen said the game would be a "measurement" for his team.
The Flyers measured up.
Contact Sam Carchidi at firstname.lastname@example.org, or follow on Twitter @BroadStBull.