SAN FRANCISCO -- Andres Torres singled home Buster Posey with two outs in the 10th inning Wednesday to lift the San Francisco Giants to a 4-3 win on a day when their opponent, the Philadelphia Phillies, learned they'd be losing standout pitcher Roy Halladay to shoulder surgery.
In avoiding a three-game sweep at the hands of the visiting Phillies, the Giants got a pinch-hit single by Posey off Phillies left-hander Antonio Bastardo (1-1) to open the 10th. Posey took second on Joaquin Arias' sacrifice bunt, then scampered to third when Bastardo's 2-2 pitch to Brandon Crawford was in the dirt and kicked away from Phillies catcher Carlos Ruiz.
Crawford walked on the next pitch. Guillermo Quiroz then struck out. Torres, who entered the game in the eighth inning in a double-switch, then sliced Bastardo's next pitch into right field for the Giants' third walk-off hit of the home stand.
The Phillies set up the extra-inning dramatics with a two-run rally off Giants closer Sergio Romo to tie the game at 3-3 in the top of the ninth. Chase Utley's one-out single scored Jimmy Rollins, who had doubled, to get Philadelphia within one, and Delmon Young followed with a sacrifice fly to plate Michael Young with the tying run.
Javier Lopez (1-0), who relieved Romo to start the 10th, got the win.
Romo, who recorded just his second blown save of the season, was the third Giants reliever of the eighth and ninth innings after Barry Zito dominated the Phillies for seven-plus innings, allowing only one run on four hits.
The Phillies entered the game on a two-game winning streak against the Giants, but the day nonetheless started on a negative note with the news regarding Halladay.
After complaining of shoulder soreness in each of his last three starts, the veteran right-hander was examined Tuesday by Dr. Lewis Yocum in Los Angeles. The findings were significant: a partially torn rotator cuff, a strained labrum and a bone spur, all in his right (throwing) shoulder.
Halladay, who will turn 36 next week, has been scheduled for arthroscopic surgery to fix all the problems, with the rotator cuff repair the most significant. The expected recovery time is a minimum of three months, which optimistically could allow the two-time Cy Young Award winner to be a factor in a Phillies' stretch drive toward a division title and/or playoff berth.
The club recalled right-hander Tyler Cloyd to take Halladay's spot in the rotation. He is scheduled to make his first start Friday in Arizona.
Rookie Jonathan Pettibone didn't pitch poorly Wednesday, allowing only three runs in 5 2/3 inning, but that wasn't nearly good enough to match pitches with Zito. In the end, however, neither factored in the decision.
Zito served up a solo homer to longtime friend -- and former Giant -- Kevin Frandsen in the fourth inning, just the second run he's allowed at home this season, but was nearly perfect otherwise, giving up just three other well scattered hits.
The last of those hits, a single by Ruiz, opened the eighth inning and prompted Santiago Casilla's entrance into the game. The right-hander got two outs, then handed off to left-hander Jeremy Affeldt, who got pinch-hitter Domonic Brown on a comebacker.
That set the stage for Romo's appearance and the Phillies' subsequent rally.
Frandsen's homer, his first of the season, offset Hunter Pence's second-inning solo shot, which also came against his ex-employer. Pence, batting cleanup with Posey getting the day off, also homered off Cliff Lee on Monday night.
Marco Scutaro's two-out single scored Gregor Blanco from second base to break the 1-1 tie in the fifth inning and put Zito in a position to record a fourth consecutive home win this season. Blanco had singled and stole second ahead of Scutaro's hit.
Zito foiled Phillies manager Charlie Manuel's strategy to intentionally walk Quiroz with two outs and Brandon Belt on third base in the sixth. Zito, who contributed a run-scoring hit to a previous home win this season, proceeded to ground Pettibone's final pitch into right field for a 3-1 lead.
NOTES: The Giants have won Zito's last 11 starts at AT&T. ... Manuel was managing his 1,331st game for the Phillies, tying him for first on the all-time franchise list with Gene Mauch. Manuel has 743 wins over that stretch, 198 more than Mauch. ... The Phillies haven't swept a three-game series in San Francisco since 1984. ... The Phillies open a four-game series in Arizona on Thursday, with Cole Hamels facing the Diamondbacks' Patrick Corbin in a duel of left-handers. ... The Giants' 10-game home stand continues Thursday with the opener of a four-game series against Atlanta, with Ryan Vogelsong opposing the Braves' Julio Teheran. ... The Phillies are hoping to fill Halladay's rotation slot long-term with left-hander John Lannan, who recorded an 0-1 record in three April starts before landing on the disabled list with a strained left knee and quad. He's expected back in mid-June. ... Cloyd, 25, was generally ineffective (4.91 ERA, eight home runs in six starts) with the Phillies last season after dominating the International League, earning the loop's Most Valuable Player honor. He was off to a slow start (1-3 with a 5.40 ERA) for Triple-A Lehigh Valley this season. ... Giants centerfielder Angel Pagan underwent an MRI on his sore groin and the pictures showed nothing more than a minor strain. He sat out Wednesday's game but could return to his leadoff spot as early as Thursday's series opener against the Braves.