CHICAGO -- San Francisco's Hector Sanchez scored the go-head run when Chicago pitcher Shawn Camp was called for a 10th-inning balk, and the Giants went on to defeat the Cubs 10-7 on Sunday afternoon.
Camp's balk came with Sanchez on third and Brandon Crawford at first with one out in a sloppy game with four lead changes and a tie.
The roof caved in from there for the Cubs. Buster Posey followed with a single to center, scoring Crawford with an insurance run while Marco Scutaro doubled home Angel Pagan for a three-run lead.
The victory gave the Giants the series win, the first time they've taken three of four at Wrigley Field since 1999.
The Cubs had rallied with two runs in the eighth to slip ahead of the Giants 7-6 when Alberto Gonzalez' sacrifice to left off Giants reliever Santiago Casilla scored Alfonso Soriano with a go-ahead run.
Earlier in the inning, Giants left-hander Jeremy Affeldt walked Luis Valbuena to score Anthony Rizzo to tie the game.
But Camp's bid to lock down a win was thwarted when Hunter Pence slammed a two-out solo home run to left, which tied the game at 7.
The Giants took advantage of a Cubs sixth-inning breakdown to score four runs to take a 5-4 lead.
Two Cubs pitchers combined for four walks and four wild pitches in the inning as the Giants erased a 4-1 deficit to overtake the hosts.
Chicago used an early outburst to build a lead.
Starlin Castro drove home David DeJesus with the first of two-first inning home runs. Nate Schierholtz followed with a two-run shot into the wind to right field for a 4-1 lead.
The Giants had taken a 1-0 when they loaded the based but scored only when Pablo Sandoval came home on a passed ball.
The Giants took the lead in the sixth. Gregor Blanco's double down the right field line with none out brought Pence home and trimmed the Cubs lead to 4-2 with runners at second and third.
Edward Jackson struck out Sanchez for the inning's first out. He then walked Crawford with a ball four pitch that sailed past Cubs catcher Dioner Navarro and allowed Pence to score and trim Chicago's lead to 4-3.
Right-handed reliever Michael Bowden fared no better. He gave up a two-run single and the lead as pinch hitter Nick Noonan drove home Blanco and Crawford and gave the Giants a 5-4 lead, their first since the opening frame.
The inning's fourth wild pitch found Noonan at third with one out. Bowden then walked Pagan for the inning's fourth walk and put runners at first and third.
Bowden coaxed a grounder out of Scutaro, who hit into an inning-ending double play.
The Giants added a single run in the sixth. Blanco doubled off reliever Hector Rondon with two out, driving in Brandon Belt for a 6-4 lead.
The Cubs got one run back in the seventh on Gonzalez' first home run of the season, sending reliever Chad Gaudin's first pitch to left and out of the park to Waveland Avenue.
Chicago tied the game 6-6 in the eighth, loading the bases with one out on Affeldt, who walked Valbuena on five pitches to bring home Rizzo who had reached base earlier with a double to right.
Affeldt departed in favor of Casilla, who was greeted by Gonzalez with a long sacrifice to left that scored Soriano for a go-ahead run.
Sergio Romo, the last of seven Giants pitchers, earned his seventh save. George Kontos, who worked one inning earned his first win of the season.
Camp, the sixth of six Cubs pitchers, suffered his first loss of the season.
NOTES: Sandoval was in Sunday's starting lineup despite banging his shin in a ninth inning tumble over a short wall while chasing a pop foul on Saturday ... The news wasn't as good for Cubs catcher Steve Clevenger, who was placed on the 60-day disabled list with a left oblique strain after striking out to end Saturday's game ... At the same time, the Cubs claimed 31-year-old right-handed pitcher Kameron Loe off waivers from Seattle. He was 1-1 with a 10.80 ERA in four relief appearances with the Mariners ... Cubs second baseman Darwin Barney also expected to be activated this week from the 15-day DL. Barney has yet to play after suffering a leg injury in spring training ... DeJesus, the Cubs leadoff batter had five doubles entering Sunday's series finale, tied with five others for the National League lead ... Posey was supposed to have two days off after Bochy opted to sit him Sunday. Posey's hitting just .211 and is hitless in three games, but the Giants manager is not worried. "As you saw last year as the season went he got better and better," said. "As the weather warms up, so does he." Posey entered late in the game as a pinch-hitter ... The Cubs are off Monday then open a three-game home interleague series with Texas with night games on Tuesday and Wednesday. The Giants are also off Monday before opening a three-game set in Milwaukee.