CHICAGO (AP) -- Ryan Dempster wanted to stay in the game. He had only thrown 83 pitches, given up three hits, was ahead 1-0 in the ninth inning and had retired 20 straight hitters at one point.
Dempster was pitching his best game of the season while winning a duel with two-time Cy Young Award winner Tim Lincecum of the San Francisco Giants .
Cubs manager Mike Quade still made the move for closer Carlos Marmol in the top of the ninth after Dempster gave up a leadoff double to pinch-hitter Pat Burrell .
Marmol yielded a game-tying single to Emmanuel Burriss but then pitched out of a bases-loaded jam.
The Cubs scored in the bottom half of the ninth on Aramis Ramirez 's pinch-hit single for a 2-1 victory Wednesday night that ended the Giants' seven-game winning streak.
"We won the game. That's the most important thing," Dempster said. "A nice win after losing a doubleheader yesterday, to come back and go out there and win a game against a tough pitcher like that."
Quade said he wanted Dempster to get the win and go the distance, if possible.
"I wanted to give him a shot. A walk or an extra-base hit in that situation, and I think I got to get Marmol in the game. A single? Maybe you let him try to pitch through it, at least another hitter," Quade said, adding he knew Dempster wanted to finish.
"I don't blame him, short of fighting me. It's a whole different animal if the pitch count is higher. He wants to finish the thing, and I want to bring a guy in that situation who is there regularly. Deep down, I don't want him losing that game, in spite of the pitch count. He didn't get a win. That's not going to take away from the performance."
In the bottom of the ninth, Sergio Romo (3-1) gave up an infield single to leadoff batter Tony Campana , who moved to second on Reed Johnson 's sacrifice. After a groundout moved him to third, Ramirez hit an 0-2 pitch to left to win it.
After Burrell led off the ninth against Dempster with a double, Marmol relieved and struck out Andres Torres , but Burriss singled to center to score pinch-runner Bill Hall with Burriss taking second.
Pablo Sandoval was walked intentionally before Aubrey Huff blooped a ball to center that Campana couldn't catch and it fell for a single. Waiting to see if the ball would be caught, Burriss held and had to stop at third, loading the bases. Cody Ross then grounded into an inning-ending double play.
Marmol got the win despite his fifth blown save in 21 chances.
After Carlos Pena doubled in the seventh, Blake DeWitt hit an RBI single to put the Cubs ahead against Lincecum, who gave up five hits in seven innings.
"I felt pretty good. I missed with a couple pitches - changeup up to Pena, fastball over the plate, up to DeWitt, but other than that I felt like I carried a good rhythm through the game," Lincecum said.
"Fell behind too many guys 2-0 and had to battle back, but I felt like I settled down by the fourth inning."
Dempster gave up a double to Sandoval in the first and another to Nate Schierholtz in the second. He then kept the Giants off base until Burrell doubled.
"It was fun competing like that," Dempster said. "Wasn't much room for error for sure. Going against him and you just try to keep executing pitches."
Lincecum walked two and struck out nine. Dempster had no walks with six strikeouts.
"He established strikes every inning by throwing a lot of them, getting them out quick and keeping the ball down in the zone, throwing good strikes when he had to," Lincecum said of Dempster.
"That's what we get out of him every time we see him. He's a tough guy to face and showed it again tonight. That's what I've come to expect when I see him pitch."
Notes: GM Jim Hendry says the Cubs won't be holding a fire sale at the trading deadline despite the team's dismal performance. Some of the team's younger talent, he said, isn't going anywhere. "Everybody thinks there is this automatic you have to be a buyer or a seller. ... We're certainly going to hold on to the people that we feel will be major contributors down the road." Acknowledging how disappointed everyone in the organization is by the Cubs' poor performance, Hendry vowed the team would not cash it in over the final three months. "We're not going to roll over and we're not going to pretend like it's, `Oh poor us and wait until next year.' We're going to get after it and play good baseball the last 90 games." ... Game-time temperature was 65 and with a wind blowing in from right at 10 mph the ball didn't carry. ... The Giants were still undecided on their starting pitchers for Saturday and Sunday in interleague games at Detroit. Madison Bumgarner will start Friday. ... The division-leading Giants finished the halfway point of the season 46-35. A year ago, when they went on to win the World Series, they were 41-40 and in fourth place in the NL West, 7 1/2 games out of first.