SAN FRANCISCO Julio Borbon and Junior Lake scored on an error by San Francisco first baseman Brandon Belt in the ninth inning, and the Chicago Cubs rallied for a 3-2 win over the Giants on Friday night.
Borbon singled leading off the inning against Giants closer Sergio Romo (3-5) and moved to second when pinch hitter Dioner Navarro walked.
After David DeJesus struck out looking, Lake reached on a fielder's choice. Anthony Rizzo then hit a ball that went through Belt's legs and into the right-field corner.
The Cubs rallied for just the fourth time when trailing after eight innings.
Jeff Francoeur had two hits for the Giants, who lost for the fifth time in six games.
Matt Guerrier (4-4) retired four batters for the win, while Kevin Gregg worked the ninth for his 20th save.
Chicago's 14th come-from-behind win came after Francoeur's two-run single off starter Edwin Jackson in the seventh gave the Giants a 2-1 lead.
The wild ending was in stark contrast to the pitching duel between Jackson and San Francisco starter Matt Cain.
Jackson faced just one batter over the minimum through four innings and carried a two-hit shutout into the seventh until giving up two walks and a double before Francoeur's two-run single.
Cain allowed six hits, struck out seven and walked one and was in line to win consecutive starts for the first time since early May until Romo's fourth blown save following the Giants' National League-leading 74th error.
The Cubs won only hours after the club completed a deal that sent Alfonso Soriano to the Yankees. Earlier this month, the team also traded pitcher Matt Garza to Texas and pitcher Scott Feldman to Baltimore.
Cubs manager Dale Sveum said he isn't sure if the team is done making moves but doesn't want it to become a distraction.
"I'm not exhaling yet," Sveum said before the game. "I don't really see anything else happening, but until that 11th hour is here, I don't think you can relax. We don't dwell on it anyway."
Nate Schierholtz, batting in the cleanup spot with Soriano gone, doubled and scored Chicago's first run to continue a strong stretch for the slugging right fielder. He went 1 for 3 and is batting .428 (9 for 21) on the trip.
Pablo Sandoval and Hunter Pence both doubled and scored for San Francisco, which dropped a season-high 10 games below .500 with the loss.
Notes The Giants activated Joaquin Arias from the disabled list, more than two weeks after the reserve infielder underwent an emergency appendectomy.
Arias started 23 games for the World Series champs this season before going on the disabled list July 8. Before that, Arias was batting .282 with 10 RBIs in 60 games.
To make room, the Giants optioned right-handed reliever Jake Dunning to Triple-A Fresno (PCL).
San Francisco acquired pitcher Guillermo Moscoso from the Cubs. Moscoso has appeared in 57 games in the majors with Texas, Oakland and Colorado but has spent this season with Chicago's Triple-A team in Iowa.
Video: Manager Bruce Bochy talks about Belt's mistakes: