The Giants won for just the second time in 10 meetings against their NL West rivals and moved within 2½ games of San Diego for first place in the division. Both of San Francisco's wins against the Padres have come in extra innings.
The Giants trailed 2-0 early but came back to tie and eventually win the game against San Diego's normally stellar bullpen.
Buster Posey led off the 11th against Tim Stauffer (3-2) with a groundball double up the middle. Second baseman Jerry Hairston Jr. tried to get to the slow roller before it got to the outfield but deflected it into left-center and Posey hustled into second.
After Pablo Sandoval was intentionally walked, Uribe blooped a single to right and Posey easily scored setting off a celebration for the sellout crowd.
Santiago Casilla (4-2) escaped a first-and-third, one-out jam in the 11th by striking out Chase Headley and getting Tony Gwynn to line out to center to earn the win. Casilla extended his scoreless streak to 13 innings.
The Padres stranded 16 runners, including the bases loaded in the eighth and two runners each in the ninth, 10th and 11th innings. San Diego had won five straight.
The Giants fell behind 2-0 early to a sharp Mat Latos and looked poised to fall once again to the Padres. But Sandoval ended Latos' day with a leadoff homer in the seventh.
After Javier Lopez got pinch-hitter Will Venable to ground out with the bases loaded to end the top of the eighth, San Francisco managed to tie it in the bottom half against nemesis Luke Gregerson.
Gregerson had allowed four baserunners and no runs in 16 1-3 career innings against the Giants before Mike Fontenot started a rally with a groundball single to right field. He went to third on Aubrey Huff's double and scored on Pat Burrell's RBI groundout. Gregerson escaped with the tie intact, but the Giants still got the win.
Latos pitched a one-hitter here in May and looked almost as dominant this start, matching his career high with nine strikeouts. He left after allowing Sandoval's eighth homer of the season, yielding five hits and no walks in six-plus innings. He threw a career-high 108 pitches.
Giants rookie Madison Bumgarner, who has lost three straight decisions following a four-game winning streak, ran into trouble right away when Headley hit an RBI double in the first. Pitching coach Dave Righetti came out for a visit later in the inning after Scott Hairston walked to load the bases and Bumgarner escaped by getting Chris Denorfia on a comebacker.
Adrian Gonzalez added an RBI double in the fifth inning.
Bumgarner allowed two runs and eight hits in seven innings.
Notes: Jake Peavy had 10 straight starts with two or fewer runs in 2004 for the Padres. ... Newly acquired OF Jose Guillen grounded out as a pinch-hitter in the ninth inning in his debut for the Giants. ... Hall of Famers Tom Seaver and Dave Winfield were at the game. ... Bumgarner needed just three pitches to get out of the third inning despite allowing a leadoff double to Miguel Tejada. Ryan Ludwick lined into an inning-ending double play. ... Giants starters are winless in their last 11 games, recording six losses and five no-decisions.