PITTSBURGH (AP) — Jakub Voracek scored the go-ahead goal with 1:31 remaining in the third period to cap a hat trick and lead the Philadelphia Flyers to a wild 6-5 victory over the Pittsburgh Penguins on Wednesday.

Voracek’s third goal came 33 seconds after Pittsburgh’s Brandon Sutter tied the game on a wraparound as the Penguins rallied from a pair of two-goal deficits in the third period.

Voracek’s first goal of the game came on the power play, giving the Flyers a 3-2 lead with 9.9 seconds left in the second period. His second, the 200th point of his NHL career, put Philadelphia ahead by two goals 18 seconds into the third period.

Wayne Simmonds had two goals and an assist and Nicklas Grossman also scored for the Flyers.

Evgeni Malkin and James Neal scored power-play goals, while Sutter, Tyler Kennedy and Matt Niskanen also scored for the Penguins.

The Flyers capped a season-long six-game road trip with two victories. Philadelphia, which routed the New York Islanders 7-0 Monday, struggled early on the road trip, dropping three of its first four games before recovering with two wins.

Tomas Vokoun, making his first start since a home loss against New Jersey on Feb. 10, took the loss.

Philadelphia appeared to put the game away after Simmonds’ second goal of the game, which hit off Niskanen’s stick went into the net, to make it 5-3 at 7:36 of the third.

But the Penguins rallied on Neal’s power-play goal at 12:46 and Sutter’s game-tying goal with 2:03 remaining.

Niskanen gave the Penguins a 1-0 lead at 5:07 of the first, the 14th time in 17 games Pittsburgh scored the opening goal.

Flyers coach Peter Laviolette called a timeout after the goal in an attempt to spark his sluggish team, which had just two shots on goal to that point, but it worked in the Penguins’ favor.

Flyers forward Harry Zolnierczyk was whistled for boarding 13 seconds later, putting Pittsburgh’s No. 2-ranked power play on the ice.

Malkin nearly converted seven seconds into the advantage, as Bryzgalov gloved a shot against the post, but the play was ruled inconclusive after an extra look by officials.

No matter.

Malkin scored later on the power play at 7:15 of the first, slamming Paul Martin’s rebound off the end boards inside the post. It was the ninth straight game the Penguins scored a power-play goal.

The Flyers settled down, scoring twice in the span of a minute to tie the game.

Grossman got the first one, firing a loose puck across the line after a wild net-mouth scramble that had four Penguins piled in the crease, desperately trying to prevent a goal.

Letang tried his best to keep the puck out of the net, stopping the initial shot at the goal line, but it eventually popped out to Grossman, who scored the Flyers’ opening goal 11:49 of the first.

Simmonds scored a minute later, taking a Danny Briere pass and powering his way to the top of the crease where he slid a shot past Vokoun.

Then things got heated between the cross-state rivals and the penalty box quickly filled with three players apiece less than a minute after the tying goal.

Penguins defenseman Deryk Engelland went off for roughing, Flyers forward Brayden Schenn for cross-checking, and unsportsmanlike conduct penalties were also issued while Tanner Glass and Simmonds had a fight.

The teams played a clean second period, combining for just three penalties, but the last one, an elbowing call against the Penguins’ Craig Adams, resulted in Voracek’s go-ahead goal with 9.9 seconds left in the period.

The rebound from Simmonds’ attempt at the top of the crease came out to the faceoff dot where Voracek fired a wrist shot past a diving Vokoun, giving the Flyers a 3-2 lead.

Voracek scored his second of the game 18 seconds into the third period, taking advantage of a miscommunication between Vokoun and Martin behind the net. Braydon Coburn’s shot after the turnover bounced to Voracek, who made it a two-goal game.

Kennedy cut the deficit to one goal at 5:29, putting the rebound from Martin’s point shot behind Bryzgalov and Simmonds’ scored his second of the game at 7:36.

Martin finished with three assists.

NOTES: Flyers forward Matt Read left the game with an upper-body injury. ... The rivals meet again March 7 in Philadelphia. ... Both teams play next at home against Florida. The Flyers host the Panthers Thursday, while the Pittsburgh welcomes Florida the following night.