PITTSBURGH -- The Giants' string of quality starts came to a halt on Monday, but the offense saved the day as reliever Jean Machi put down a 13th-inning sacrifice bunt that resulted in a throwing error by Pirates reliever Jared Hughes, allowing Hunter Pence to score as the Giants pulled out a wild 11-10 win at PNC Park.
"Machi's a good athlete and he can swing the bat a little, he can bunt," Giants manager Bruce Bochy said. "If there was two outs I probably would have let Tim Hudson hit, he's a pretty good hitter, too. In that situation I wanted Machi to bunt. Plus he runs well, he's a good athlete; looks are deceiving in this case because he's a guy that runs well, but he made it look easy. What a great bunt."
"I think the pitcher was a little bit slow reacting to go get the ball," Machi said. "When I saw that I used all the speed that I had and I think we got there almost at the same time, the ball and me."
"I played with Machi, in 2009 in Altoona," Hughes said of the former Pirates farmhand, who signed with the Giants as a Minor League free agent prior to the 2011 season. "And he was one of the fastest pitchers on that staff, so I knew he could run. And a good throw still would've had him."
The victory increased the Giants' winning streak to six games. Machi picked up the win, upping his record to 5-0. Hughes took the loss.
The Giants rallied in the top of the ninth against Pirates closer Mark Melancon. Pence singled, advanced to second on a wild pitch and came around to score on a single by Buster Posey to tie the game at 10.
"What a game," Bochy said. "We were literally dead in the water there, and it's one of the grittiest I've been involved with, with this group. We've had some good comebacks, but tonight was one of the best ones. I mean you travel, you get here and you get down six runs, and they found a way to get it done."
The Pirates had taken the lead when pinch-hitter Jose Tabata delivered an infield single off Giants reliever Jeremy Affeldt in the seventh. Ike Davis scored on the play.
Giants starters had turned in a quality start in eight of their last 11 outings, but Yusmeiro Petit, starting in place of the injured Matt Cain, tossed 4 1/3 innings and allowed eight runs on nine hits.
The Pirates recalled lefty Jeff Locke for the start. He pitched 5 1/3 innings, giving up six runs on eight hits.
The Giants jumped out to a 2-0 lead in the top of the first inning. With two outs, Michael Morse doubled inside the third-base bag to drive in Posey, who had singled. Hector Sanchez then stroked an single to right to knock in Morse.
The Sanchez RBI single snapped a 0-for-13 streak for the Giants with runners in scoring position. For the game, the Giants wound up with eight hits with runners in scoring position.
The Pirates broke through against Petit in the bottom of the third inning. With one out, Josh Harrison singled and stole second base. He scored on a single by Neil Walker. Andrew McCutchen singled, and then Pedro Alvarez launched a three-run home run into the center-field bullpen to give the Pirates a 4-2 lead.
The Pirates upped their lead to 5-2 in the bottom of the fifth inning. With one out, McCutchen doubled down the third-base line. The play was originally ruled a foul ball, but was overturned after the Pirates challenged the call. Alvarez singled to drive in McCutchen.
Right-hander Jake Dunning came on in relief of Petit. Dunning uncorked a wild pitch and Alvarez scored. Dunning threw another wild pitch to score Starling Marte. Dunning got Clint Barmes to hit a sacrifice fly, which resulted in a double play. Davis scored on the play and the Pirates led 8-2.
"Petit was having a hard time hitting his spots, and Dunning, too," Bochy stated. "I think Dunning may have been a little nervous."
Sergio Romo tossed a scoreless 13th inning to notch his 10th save.
The last time the Giants overcame a six-plus run deficit in a game was May 16, 2013.
"It's one of 162, but at the end of the day it's about playing hard and never giving up," Pence said. "That's the attitude we have here. We're going to continue to do that regardless of what happened yesterday, regardless of what happened a week ago. Today our goal is to play as hard as we can."
George Von Benko is a contributor to MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.