AP Sports Writer
SAN DIEGO (AP) -- The San Diego Padres got off to a good start against All-Star lefty Madison Bumgarner, scoring two runs on three hits in the first inning.
The wouldn't score again all night.
"You never know when a key inning is going to happen," Padres manager Bud Black said after the Padres lost 4-2 to Bumgarner and the San Francisco Giants on Thursday night. "As this game played out, and the way he pitched after the first, that was our best opportunity. We were one big hit away from stretching that lead.
"He settled in, he got stronger and shut us down."
Bumgarner allowed just four hits in seven innings, and Pablo Sandoval hit his first home run since May 21 as the Giants won in a matchup of the worst teams in the weak NL West.
The defending World Series champion Giants, who snapped a four-game losing streak, have been in a free-fall since June 15. They had lost 19 of 24 games coming in and were a season-high 10 games under .500. They started the night two percentage points behind the Padres and ended it by jumping past San Diego into fourth place.
Bumgarner (10-5) retired 15 in a row after his rough first inning before Carlos Quentin singled with two outs in the sixth. The lefty struck out six and walked one.
The Giants are 2-8 in July, with Bumgarner getting both wins. Sergio Romo pitched the ninth for his 21st save in 24 chances.
The Padres have lost 16 of 19.
Sandoval got San Francisco's weak offense going in the fourth with a leadoff homer to right-center off Jason Marquis, his ninth.
It was Sandoval's first homer in 101 at-bats. Sandoval, who was on the disabled list from June 9-24 with a strained left foot, was 6 of 55 (.109) before that at-bat.
The Giants had the bases loaded three times in the sixth and seventh innings but scored only one run.
Marquis took a 2-1 lead into the sixth and struck out Buster Posey leading off the inning before loading the bases and allowing Kensuke Tanaka's RBI single up the middle. Marquis made way for Joe Thatcher, who got Brandon Crawford to hit into a force at the plate. Dale Thayer came on and struck out Bumgarner to end the inning.
The Giants loaded the bases again in the seventh on two singles and a hit batsman, and Thayer again got out of trouble by striking out Belt to end it.
San Francisco finally broke through in the eighth with two runs and three hits off Luke Gregerson (4-5), including an RBI double by Blanco that bounced over the fence in left, and Posey's RBI single to left.
In the first, Quentin hit an RBI double and, after Jesus Guzman was intentionally walked to load the bases, Kyle Blanks drove in a run on a fielder's choice. Bumgarner got Logan Forsythe to line out to second to end the inning.
"He's got such good pitches and he makes you think about his cutter and he fools you with something else," said Everth Cabrera, San Diego's only All-Star. "He's really tough, probably as tough of a pitcher that we face."
Marquis failed for the fifth time to get his 10th victory. He allowed two runs and seven hits in 5 1-3 innings, struck out three and walked two.
NOTES: The Giants have won 10 of Bumgarner's last 11 starts against the Padres. ... The four-game series continues Friday night when right-hander Sean O'Sullivan makes his debut for his hometown Padres against San Francisco RHP Chad Gaudin (2-1, 2.44 ERA). O'Sullivan, who graduated from Valhalla High in suburban El Cajon in 2005, was signed by the Padres as a minor league free agent in December. It will be his first big league start since Sept. 27, 2011, with the Royals. ... Padres 1B Yonder Alonso is expected to be in the starting lineup for Friday's game He has been on the disabled list since May 31 with a broken right hand.
Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.