Ryan Dempster was in search of his first road victory of the season Wednesday night at AT & T Park, and he looked like he was on his way with a three-run lead over San Francisco heading into the seventh inning.
But manager Lou Piniella removed Dempster after 91 pitches for Carlos Marmol, who promptly served up a three-run home run to Giants second baseman Ray Durham to cough up the lead.
Mike Fontenot's solo shot off Tyler Walker in the eighth put the Cubs back on top, and they wound up winning 6-5 before 41,345 on a wild night in San Francisco.
Kerry Wood worked the ninth and, after giving up a two-out triple to Jose Castillo, struck out Fred Lewis looking for his his 21st save.
Before the game, Piniella said he wanted to give Marmol some work because he hadn't pitched since Saturday's game against the White Sox at U.S. Cellular Field.
"One thing, our short people are very rested," Piniella said. "But that's not very good, because that means you're not winning. When your short people are a little tired, you've been winning. When they're real rested, you have some problems on the 'W' end. [ Bob] Howry got some work [Tuesday] night, and [Wood] got some the night before. Let's just win some baseball games. That's all I'm interested in.
"It has been tough lately. It really has. It hasn't been easy."
And it wasn't any easier Wednesday, despite another sterling performance from Dempster.
The Cubs right-hander was going for his first triumph on the road since June 2, 2006, at St. Louis, when he was still pitching in relief.
The last time Dempster won a road game as a starter was April 16, 2005, at Pittsburgh, shortly before he replaced LaTroy Hawkins as the Cubs' closer.
Though he allowed only two runs on five hits over six innings Wednesday, striking out seven, Dempster's winless streak on the road continued.
The Cubs took a 1-0 lead in the second inning on Matt Murton's double-play grounder, and Dempster held the Giants scoreless through the first five.
They added to their lead off Kevin Correia in the sixth on Geovany Soto's one-out double and Jim Edmonds' two-run opposite-field homer. At that point, it looked like Dempster was on cruise control.
But Giants first baseman John Bowker hit a two-run blast into McCovey's Cove in the sixth, and though Dempster led off the seventh by grounding out, he did not come back to pitch the bottom of the inning.
McCovey's Cove has been a lonely place since the Giants waved goodbye to Barry Bonds last winter.
Bonds hit 35 home runs into the bay during his career at AT & T Park, and a flotilla of kayaks patrolled the waters on a daily basis whenever the Giants were playing at home.
But only two balls had cleared the right-field fence and gone into the bay in San Francisco's first 40 home games this year, which was why only a handful of kayaks were around Wednesday night when Bowker poked his sixth-inning shot into the water.
As it turned out, Bowker's splash landing was the only blemish on Dempster's performance.
The Cubs came back in the seventh, scoring a pair of runs on Soto's two-run single to take a 5-2 lead.
Marmol entered in the seventh and struck out the first two men he faced, looking like the Marmol of old.
But a walk to pinch-hitter Travis Denker and a Lewis single brought up the switch-hitting Durham, who cranked Marmol's first pitch into the right-field bleachers, spoiling Dempster's chance for a road win.