CHICAGO -- Jeromy Burnitz's game-winning hit earned him a shaving-cream pie in the face.
As Burnitz spoke during a postgame interview, winner Ryan Dempster (5-3) got him with the shaving cream.
"That's the first time that happened to me," Burnitz said. "It made the day. I kind of enjoyed it."
Chicago trailed 3-2 in the eighth when Derrek Lee singled leading off against former-Cub LaTroy Hawkins. With Scott Eyre pitching, Aramis Ramirez reached on a one-out error by shortstop Omar Vizquel, his first in 60 games.
Pinch-hitter Matt Murton hit a fly ball that right fielder Michael Tucker lost in the sun and allowed to drop for an RBI single. Had Tucker caught the ball, Lee likely would have tagged up at third and scored.
In the ninth, Jody Gerut pinch hit for Dempster and was walked by Kevin Correia (1-3) leading off the inning. Jeff Fassero relieved, Jose Macias sacrificed and Todd Walker flied out.
Lee, who leads the major leagues with a .367 average, was intentionally walked. Fassero's first three pitches to Burnitz were balls. Burnitz took a called strike and then fouled off a pitch before driving in Gerut with a sharp single to right.
"I think I swung at ball four, a high fastball, " Burnitz said of the foul ball. "Then he threw me a slider that was right there to hit, and I took a good hard hack at it."
Dempster pitched a perfect ninth for the win.
San Francisco manager Felipe Alou used four relievers in the final two innings following a strong outing by starter Brett Tomko. The right-hander, who rejoined the Giants rotation on July 7, allowed two runs on five hits, while striking out six and walking three.
"Eyre was gassed," Alou said. "We knew that the game was going to be decided by Lee and Burnitz. When Correia walked the lefty (Gerut), we wanted to save him for tomorrow and we took him out."
Cubs starter Carlos Zambrano allowed three runs and 11 hits in 7 1/3 innings. Zambrano hasn't lost since June 22 at Milwaukee and has pitched at least seven innings in every start and allowed three runs or fewer.
Zambrano settled down after the first three Giants reached, retiring the next 10 batters. He got some help in the first when Jason Ellison was caught stealing second by catcher Henry Blanco, then with runners at the corners retired Pedro Feliz on a popout and Michael Tucker on a flyout.
Vizquel had three hits for the Giants, including a double, and San Francisco outhit the Cubs 13-8.
Lee and Ramirez hit run-scoring singles that put the Cubs ahead 2-0 in the third, but Snow hit an RBI single in the fifth before Zambrano ended the inning by striking out Edgardo Alfonzo with the bases loaded.
San Francisco took a 3-2 lead in the eighth when Yorvit Torrealba hit an RBI double and scored on a single by pinch-hitter Ray Durham that chased Zambrano.
"He asked me it I wanted to go out in the eighth inning," Zambrano said of manager Dusty Baker. "I said yes. I felt competitive and I want to throw eight innings today. I just made a mistake in the eighth inning today and I paid for it."