Matt Read, Michael Raffl and Giroux each scored during a 2 1/2-minute span early in the final period to erase a 2-1 deficit and grab control of the contest.
Giroux assisted on Jakub Voracek's goal with 2:16 left in the game to cap the outburst as the Flyers set a franchise record with their 10th win this season when trailing in the third period.
Mark Streit also scored and Scott Hartnell added a pair of assists for Philadelphia, which went 2-1-0 on a three-game California road trip.
Steve Mason turned aside 20-of-22 shots.
Matt Nieto got both goals for the Sharks, who dropped fourth in five games.
Antti Niemi allowed four goals on 23 shots before being pulled in third period.
Alex Stalock stopped 4-of-5 the rest of the way.
Ohio bar shooting arrested, charged with murder
McPhee, Cokas 'working on their marriage' after affair