SAN FRANCISCO — Jean Machi and the San Francisco Giants ended their six-game losing streak in the most wacky way. They don't care how it happened, any break is welcome these days.
A timely, heads-up glance by Machi helped San Francisco take advantage of a huge baserunning blunder by Pittsburgh, and the Giants tagged out of two runners who wandered away on the same play to beat the Pirates 7-5 Wednesday.
"Just like we drew it up, right?" second baseman Joe Panik quipped. "We got lucky with that one. Everything happened so quick. Almost like Little League, a rundown, playing a game of 'Pickle.'"
San Francisco stopped a skid that matched its longest of the season, and avoided the club's first winless homestand of at least seven games in the 15-year history of AT&T Park.
The Pirates, who had won three in a row, led 5-4 in the sixth when Chris Stewart drew a one-out walk with runners on second and third.
Machi (6-0) got the ball back from the catcher and noticed Travis Snider had left second base, apparently thinking it was a bases-loaded walk.
"Absolutely! It was 100 percent mental error on my part," Snider said. "Offensively, we could have made something happen. Honestly, I was thinking about getting to third base and if he walked I'd get to third. That's obviously not what you want to happen when you have first open. I take ownership for that mistake."
Machi threw to shortstop Brandon Crawford to trap Snider in a rundown. Crawford tagged Snider, then saw Gaby Sanchez stray off third and break for home.
Crawford threw to Machi, who tossed back to third baseman Pablo Sandoval to get Sanchez.
"You don't see that very often. We got a break there," manager Bruce Bochy said. "I haven't seen that. He must've thought the bases were loaded, going to third."
Gregor Blanco hit a tying single in the seventh, and a passed ball by Stewart later in the inning put the Giants ahead. Justin Wilson (3-2) took the loss.
Santiago Casilla, San Francisco's fifth reliever after Tim Lincecum's short start, earned his eighth save in 11 chances.
Jordy Mercer hit a two-run homer in the fourth and Josh Harrison also connected for the Pirates. But the blunder on the bases left manager Clint Hurdle baffled.
"You know, I have a buddy and we always talk about how if you watch enough games you'll continually see something you have never seen before," he said. "Unfortunately, that's the first time I've seen us walk into a double play."
Bochy met with slumping Crawford before the game about tweaking his hitting mechanics, then moved him up to the No. 2 hole. Crawford's single started a three-run first on a day the Giants' runs were more than the six they had total in the previous six games.
HARRISON'S POP: Harrison's ninth home run was his fourth longball in as many games. The Pirates have nine homers in their last five games.
"We call it game-time pop," Hurdle said.
SUSAC'S FIRST HIT: Andrew Susac recorded his first career hit and RBI in the third for San Francisco. Starting at catcher as Buster Posey played first base, Susac was 0 for 5 in four games before his single. He was promoted Saturday from Triple-A Fresno with Hector Sanchez out because of a concussion.
"It's awesome. I can't explain how it feels," he said.