The Cubs had taken a 7-6 lead with two runs in the eighth, but reliever Shawn Camp (0-1) couldn't hold it in the next frame, surrendering a long, two-out solo homer to Pence.
The Giants then broke it open with three runs in the 10th, taking the lead when Camp balked in Hector Sanchez from third base.
Pence finished 3-for-4 while Gregor Blanco and Nick Noonan each added two RBI.
George Kontos (1-1) earned the decision with a scoreless top of the ninth and Sergio Romo collected his seventh save.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Aaron Carter is still in love with Hilary Duff