Marquis turned in one of his better outings, allowing two runs on four hits over seven innings. But he was outpitched by Giants starter Matt Cain, who improved to 5-6 with eight shutout innings, allowing just two hits while striking out 10.
"Matt threw the ball real well," Marquis said. "His talent speaks for itself."
The Cubs entered July in first place for the first time since 2001 and still managed to hang on to their 21/2-game lead over St. Louis, which lost to the Mets. But they lost for the ninth time in their last 14 games.
"We had a few chances," Cubs manager Lou Piniella said. "Not too many, but we had a few chances and didn't quite get it done."
With his team leading 2-0 in the ninth, Giants manager Bruce Bochy sent out closer Brian Wilson. Wilson made it interesting, but he posted his league-leading 23rd save, stranding the tying run on second.
After Derrek Lee led off the ninth with a triple into the gap in right-center, Daryle Ward was retired on a popout to third. Geovany Soto singled to right to make it 2-1 before Jim Edmonds popped out to center.
Mike Fontenot reached on an infield hit, bringing up Ryan Theriot, who had entered as a pinch-hitter in the seventh after being scratched as a starter with the stomach flu. Theriot fouled off several two-strike pitches before striking out on a 96 m.p.h. fastball to end it.
"[Wilson] has great stuff," Theriot said. "He's always been a guy that can cut the ball as well as run it in, a good breaking ball. I was looking for a heater, and he threw me a ton of them. I just couldn't catch up to it."
The Cubs' offense never got on track all night, and the Giants scored off Marquis in the first and never trailed again.
After Fred Lewis singled leading off, Marquis walked Ray Durham. Randy Winn followed with a potential double-play grounder to shortstop Ronny Cedeno, but instead of flipping to Fontenot at second, Cedeno ran over for the forceout and threw late to first, leaving runners on the corners and one out.
Winn stole second, and Lewis took off after Soto's throw to Fontenot, stealing home for the Giants' first run.
"I think it might have caught Fontenot a little by surprise," Piniella said. "Though that kid at third base (Lewis) can run pretty well too."
Cain, meanwhile, dominated the Cubs all night long. After Kosuke Fukudome reached on an error leading off the first and Lee stroked a one-out single, Ward grounded into an inning-ending double play.
Cain didn't allow another hit until Ward doubled leading off the seventh. But after Soto was called out on strikes, Edmonds hit a long fly to the warning track in center, standing at the plate and admiring the shot, which never had a chance.
Aaron Rowand made a nice grab, bounced off the wall and threw in quickly, though Ward was going nowhere. After Fontenot walked, Theriot pinch-hit for Cedeno and took a third strike, ending the inning.
The Giants added a second run off Marquis in the bottom of the seventh on a double by Lewis and an opposite-field RBI single by Winn.