The Orange and Black let a 3-1 second-period lead evaporate, but came back to retake the lead 4-3 with five minutes left to play. Then with an empty net, Mark Recchi scored with 32-seconds left in the game to even the score at four.
The Bruins got out to an early lead as Mark Recchi scored the first of his two goals on a putback shot as Brian Boucher was down on his side. Danny Briere tied the game for the Flyers with less than a minute to play in the first-period on a one-timer.
The Flyers came out in the second period firing as Chris Pronger and Claude Giroux scored to give the Fly Guys a 3-1 lead. Michael Ryder scored three minutes after Giroux's goal to make it 3-2 Flyers going into the third-period.
Milan Lucic tied the game at the three for the Bruins on a power play goal that deflected past Boucher.
It looked like Ville Leino scored the game-winning goal on a deflection off a Pronger shot that beat Bruins goalie Tuukka Rask.
Recchi's goal late in the third period beat Boucher high and silenced the crowd.
In partnership with NBC Sports Philadelphia
Gagne's game-winner came off a turn-around pass from Mike Richards to Matt Carle, who fed Gagne in front of the net.
The series now swings back to Boston on Monday for game five as the Bruins lead the series 3-1.