SAN FRANCISCO -- Clint Hurdle is never sure how the Pittsburgh Pirates will win.
On a night breakthrough pitcher Jeff Locke struggled with his command, the offense delivered all through the lineup.
Pedro Alvarez hit a go-ahead, two-run double to start a seven-run fifth and matched his career high for RBI in a season with 85. Russell Martin and Gaby Sanchez added sacrifice flies and Tabata doubled in his second plate appearance of the inning.
"You can't write this stuff up. It's a great game, it's a crazy game, it makes you laugh, it makes you cry," Hurdle said. "This team, we believe in us and whatever it's going to take. We don't always know how it's going to happen but we're going to keep playing and covering each other's back and keep having fun along with it. Sometimes that's a little bit more of a challenge than other times."
Giants right-hander Matt Cain departed after getting hit on his pitching arm on a line drive by Sanchez. X-rays on Cain's bruised forearm were negative.
Jones' 12th home run leading off the second was a splash-hit drive into McCovey Cove beyond the right-field wall. It was the 28th at AT&T Park by an opponent and second by a Pirates player. Adam LaRoche hit one on Aug. 11, 2007, against Tim Lincecum.
"It's definitely a step forward in the right direction," said Jones, batting .239. "I felt better up there timing wise. I just need to do it consistently."
Cain was hit when Sanchez led off the fourth with a groundout. Trainer Dave Groeschner and manager Bruce Bochy hustled out to check on the pitcher, who walked off the mound on his own moments later.
Manager Bruce Bochy expected to know more about Cain's condition Friday.
"That ball was smoked. It caught him flush. He has a pretty good contusion. He's really sore. We'll know more tomorrow. We're not going to take any chances."
Cain allowed three runs and seven hits in 3 1/3 innings. Guillermo Moscoso (1-2) relieved with the Giants trailing 3-1.
Cain, who had been on a nice roll since the All-Star break, threw 64 pitches, 40 for strikes.
"It caught me pretty good. It didn't feel right, right off the bat," he said. "Like the time in 2009, I had the feeling it wasn't very good."
Tabata added a pair of singles for his third three-hit game in August.
On a day the Giants lost outfielder Andres Torres perhaps for the season to a strained left Achilles tendon, the defending World Series champs were dealt another blow with the early exit for Cain. San Francisco was outscored 21-4 in a losing three-game series against the Red Sox -- including 12-1 in Wednesday's finale.
It wasn't much better in the opener of a four-game series with the Pirates. Brandon Crawford added a two-run double in the eighth for San Francisco.
"It's definitely not what we had planned with Pittsburgh coming in," Cain said.
Third baseman Pablo Sandoval returned to the Giants' lineup after missing two games with a sore back. He grounded into a double play in the second and wound up 1 for 3 with a walk.
- Pirates GM Neal Huntington said LHP Wandy Rodriguez (forearm tightness) felt pain during his simulated game and will be examined by Dr. James Andrews early next week.
- Bochy said struggling LHP Barry Zito (4-9, 5.63 ERA) is scheduled to make his next start. "We're keeping the guys in the rotation where they're at," Bochy said.
- Pirates RH closer Jason Grilli, nursing a strained tendon in his throwing arm, threw a 25-pitch bullpen and is scheduled for another side session Sunday before a likely rehab outing. "Another good day for Jason," manager Clint Hurdle said. "We'll see how he bounces back tomorrow."
- Hurdle believes OF Starling Marte is close to returning and won't need a DL stint. He missed his fourth consecutive game because of a bruise on his right hand after getting stepped on during a headfirst slide against Arizona on Sunday. "I think Marte is right on the edge of coming back," Hurdle said. "He's closing in on that -- return to play."
- The Giants are 9-22 vs. the NL Central.