PHILADELPHIA — Hit or no hit, Maikel Franco was just happy the Phillies won.

Franco drove home the winning run with one out in the 12th inning on a play that eventually was ruled a single to give Philadelphia a 5-4 victory over the struggling San Francisco Giants on Wednesday night.

Ryan Howard homered among his three hits and Cameron Rupp also connected for Philadelphia. Franco finished with three RBIs, including one on the unusual sequence that ended the game.

With the bases loaded and one out, Franco lined what appeared to be a clean single into right-center field. But young teammate Aaron Altherr, who was on first base, got so excited about the Phillies winning that he rushed out to right field to congratulate Franco without ever touching second base.

Giants catcher Buster Posey noticed the blunder and took a throw at second from right fielder Hunter Pence — and second base umpire Dale Scott signaled that Altherr was out. Franco did indeed cross first base, though, so Tommy Joseph scored easily from third and the Giants had no chance at an inning-ending double play.

"When I saw (Hunter) Pence run out to center field to get the ball, I was like, 'What's going on here?'" Altherr said. "Then when I saw him throw to second I was like, 'Oh, (no).' I feel terrible about it. I'm just thankful we still got the win."

Altherr said he would buy Franco dinner if the mistake cost his teammate a hit, but after a long delay following the game, the official scorer credited Franco with a single.

"It's more important that we won the ballgame," Franco said before the ruling. "I got my RBI, we win the ballgame, that's what this game is all about."

Posey singled, doubled and drove in three runs for the NL West leaders, who have lost 13 of 17 since the All-Star break. Denard Span had three hits.

George Kontos (2-2) started the 12th by hitting Joseph with a pitch. He went to second on Luis Garcia's sacrifice bunt and Philadelphia had runners on first and second with one out after Kontos walked Cesar Hernandez.

Giants manager Bruce Bochy called on Jake Peavy for his first appearance since being demoted to the bullpen when the team acquired left-hander Matt Moore from Tampa Bay on Monday.

Peavy induced a grounder by Altherr, but he reached to load the bases when third baseman Eduardo Nunez bobbled the ball for an error.

Franco then drove the next pitch from Peavy into right-center.

"Anytime you win in extra innings, it's a great win," Phillies manager Pete Mackanin said. "When you lose, it's terrible."

Garcia (1-0) pitched a scoreless inning for the win, capping an impressive performance by Philadelphia's bullpen. Six relievers combined to pitch seven shutout innings while allowing two hits.

"That was difference in the game," Bochy said. "Their 'pen shut us down completely."

The teams combined to use 14 pitchers in a game that took 4 hours, 2 minutes.

Franco hit a two-out, two-run single in the eighth off Giants starter Johnny Cueto to tie the score at 4 and complete Philadelphia's comeback from a 4-0 deficit.

FOR STARTERS

Giants: Cueto was cruising along until giving up a pair of homers in the seventh and Franco's hit in the eighth. He was lifted after allowing four runs in 7 2/3 innings while recording his 12th career double-digit strikeout game by fanning 10 Phillies. He gave up seven hits and walked one.

"I felt normal," Cueto said through a translator. "I made all my pitches. The only thing I can say is they beat me."

Phillies: Phil Klein recovered from a shaky first inning in an emergency start and lasted five innings, giving up four runs and eight hits. Philadelphia scratched scheduled starter Aaron Nola 4 hours before the game and placed him on the 15-day disabled list with a strained elbow.

Prior to Wednesday, Klein made eight relief appearances for Texas this season and had pitched 36 games in his big league career. He was a 30th-round selection by the Rangers in 2011.

Klein was optioned back to Triple-A after the game.

NOLA SIDELINED

Nola (6-9, 4.78 ERA) said he felt discomfort after his most recent start on Thursday in Atlanta.

"But I really didn't think it was anything," he said. "It just kind of got sore a little bit. It kind of prolonged for the next couple of days and I told the (Phillies staff)."

The 23-year-old righty has been struggling for nearly two months and has a 9.82 ERA in his last eight starts. The Phillies skipped him once in the rotation before the All-Star break, but Nola said his struggles have had nothing to do with his health.

"No, no, I never felt any pain or any soreness," he said. "I guess it just kind of flared up in that one game."

Nola hopes to return this season, though the Phillies could be cautious with a young pitcher who is considered one of the key cornerstones in their rebuild.

UP NEXT

The teams conclude their three-game series Thursday afternoon when Phillies RHP Vince Velasquez (8-3, 3.32 ERA) opposes Moore (7-7, 4.08).

(Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed)

More From New Jersey 101.5 FM