Gostisbehere tied it 4-4 on the power play with a shot from the point at 14:14.
"It was good for us to break through there, tie the game up," Gostisbehere said. "But I think it was more important for our team to tie the game up, come back. We didn't have the best game out there, but good teams find a way to win."
Sean Couturier and Joel Farabee each had two assists for the Flyers (13-7-3). Carter Hart allowed three goals on eight shots and was replaced to start the second period by Brian Elliott, who made 11 saves.
"I replaced him because I didn't think he had been good enough, so I said to him 'Moose' (Elliott) was going in," Flyers coach Alain Vigneault said. "At the end of the day, it's the toughest position in hockey. Carter is a very young goaltender (22 years old). We all believe in him. We all think that he's got a tremendous amount of potential. But it's a tough position. He's going to learn from this, he's going to get better.
"I believe he's got to battle a little bit harder in goal at this time. And I'm confident that he'll work with [goalie coach] Kim [Dillabaugh] and try and get his game to where it needs to be so that our team can have a chance in every game."
Couturier and Nolan Patrick scored in the shootout for Philadelphia.
Sam Reinhart scored twice, and Taylor Hall had two assists for the Sabres (6-14-4), who have lost eight in a row (0-6-2). Jonas Johansson made 29 saves.
Buffalo played without center Jack Eichel (upper body). He missed games Feb. 25 and 27 with a lower-body injury.
"Jack went back to Buffalo early," Sabres coach Ralph Krueger said. "Still being assessed. He'll be out minimum a week."
James van Riemsdyk scored off a pass from Farabee in the high slot to give the Flyers a 1-0 lead at 1:56 of the first period.
Reinhart tied it 1-1 at 4:33 from the left face-off dot, ending the Sabres' goal drought against the Flyers at 185:44. Philadelphia shut out Buffalo 3-0 on Jan. 19, 3-0 on Feb. 27 and 3-0 on Feb. 28.
Riley Sheahan put the Sabres ahead 2-1 at 9:39 with a backhand in front of the net. Reinhart scored from the edge of the right circle to extend the lead to 3-1 at 16:39.
"We were moving our feet," Reinhart said. "We were supporting each other coming out of our end and through the neutral zone, and it led to some good opportunities."