CHICAGO -- Geovany Soto was waiting for a fastball as he stepped to the plate in the 13th inning. It never came, and it didn't matter.
Soto's drive finished off an eventful day for the Cubs.
Jeff Baker doubled with two outs and scored the tying run on a single by Darwin Barney, who had checked his swing on the previous pitch -- an 0-2 slider. Ramirez then intentionally walked Starlin Castro, and Soto, batting for Grabow, launched a 3-2 pitch over the wall in left to give the Cubs the win and the series split.
"I was just trying to get a fastball. See it. Time it. He never threw one," Soto said after hitting the first game-ending homer of his career. "On 3-2, I just try to see the ball, see it up, breaking pitch up. I knew Pena was on deck and a lefty. He left it a little bit up, and I put good wood on it. It feels unbelievable."
Chicago will take that after dropping a day-night doubleheader before pulling out a 2-1 win on Wednesday. The Cubs will try for their first three-game winning streak this season when they open a weekend series against the White Sox on Friday.
The Giants managed just five hits and went 10 1/3 innings without one before Sandoval went deep, wasting another dominant start by Matt Cain.
"We've got to get these bats going," Giants manager Bruce Bochy said. "We've got some guys who are scuffling. So, we'll have to make some changes here."
Even so, they were in line to win this one. But they just couldn't close it out.
"You have to make the last three outs," Sandoval said. "Two outs. Two strikes. We lost the game."
Ramirez, whose pinch-hit single in the ninth gave the Cubs their victory a day earlier, came up big again with his team trailing 1-0 in the ninth and Wilson going for his major league-leading 25th save. He drove a 3-1 pitch out to left for his 299th career homer and 10th this season.
"He's not only a great hitter but a great clutch hitter," Cubs catcher Koyie Hill said. "The last two days, he's proven that."
And Soto? Well, no one appreciated that homer more than Hill, who caught the entire game.
"We're pretty tight, but we're really tight today," Hill said. "That was nice. That was fun for him to hit that."
The Giants loaded the bases against Grabow in the 12th on walks to Cody Ross and Nate Schierholtz to start the inning and an intentional pass to Miguel Tejada with one out. But they came away with nothing when pinch hitter Aubrey Huff flied to shallow center and Aaron Rowand lined to right.
Cain pitched four-hit ball over seven scoreless innings for his second straight start. He struck out six and walked one, just as he did in his previous outing against the Cleveland Indians.
For the Cubs, it was an alarming sight to see Zambrano leaving early. He arrived at the ballpark in discomfort, and his day ended when he threw a ball to Eli Whiteside after an RBI single by Tejada.
He started stretching his back, and trainer Mark O'Neal and pitching coach Mark Riggins rushed out with manager Mike Quade following. Marcos Mateo then relieved with the Giants leading 1-0. That was all for Zambrano, who got booed as he walked off the mound.
Carlos Marmol worked the 10th and 11th, and Grabow escaped a bases-loaded jam in the 12th before giving up the home run in the 13th.
"God bless Mateo," Quade said. "Are you kidding me? The whole bullpen, obviously, was great, but he was better than great, to give us that length and that quality. Man oh man, what a great job by that kid. Saved us. Helped us win the game. Helped us for tomorrow. Just a huge effort."
Cubs reliever Kerry Wood, out with a blister on his right index finger, expects to come off the DL in time for this weekend's series against the White Sox. ... Cubs outfielder Marlon Byrd will likely rejoin the team Monday in Washington. He's been out since May 21 with facial fractures sustained when he was beaned by the Boston Red Sox's Alfredo Aceves. ... Bochy is leaning toward having Barry Zito start Saturday against the Detroit Tigers. ... Wilson had gone 44 outings without allowing a homer, since serving one up against the Los Angeles Dodgers on Sept. 15, 2010.