Playing at Petco Park, perhaps his least-favorite ballpark, Bonds extended his homerless streak to one week Friday night. He was long gone by the 10th, when Hairston hit his second home run of the game to give the Padres a 4-3 win over the Giants.
Meanwhile, the top two teams in the division were meeting up in Los Angeles, and Snyder homered in the eighth as division-leading Arizona extended its lead with a 1-0 victory.
The Padres are now in second in the crowded NL West race, 1 1/2 back. The Dodgers are two out, and the pesky Colorado Rockies remain 3 1/2 out after beating the Atlanta Braves.
Bonds was facing Greg Maddux, who already leads a list of 444 pitchers to surrender a home run to Bonds, giving up eight along with four other pitchers. The 41-year-old with Hall of Fame credentials had no intention of serving up No. 9.
"You don't want to be that guy," Maddux said. "I know I didn't want to be that guy. It felt different, a little more important."
Bonds finished 0-for-4.
Hairston, who replaced injured left fielder Milton Bradley in the sixth, hit a tying three-run homer to left in the eighth. His winning shot came off Jack Taschner (2-1). Heath Bell (5-3) got the win.
It was the first multihomer for Hairston, who was acquired from Arizona on July 28, and his first game-winning shot.
"I was just telling myself to be aggressive," he said. "That's why you play the game, for moments like that. It was a playoff atmosphere."
In other NL games, it was: Milwaukee 2, Philadelphia 1; New York 6, Chicago 2; Colorado 9, Atlanta 2; Houston 8, Florida 2; Cincinnati 13, Pittsburgh 4; and Washington 3, St. Louis 2.
In Los Angeles, Doug Davis outpitched Chad Billingsley (7-2) in a game that was scoreless through seven innings.
Davis (8-10) struck out five, walked one and allowed only one runner past first base. He has allowed only one unearned run over 30 career innings against the Dodgers.
"There weren't a lot of pressure situations, so it might have looked a little easier than it was," Davis said. "I had a game plan going out there, and I was just executing my pitches and throwing them for strikes."
Snyder drove Billingsley's second pitch of the eighth just inside the left field pole for his ninth homer.
"In that situation, he's not going to walk me and put the leadoff guy on. He's got to come right after me," Snyder said. "The ball was up and out over the plate, and I knew I got it good. I saw it hooking at the last minute, but I kept it straight long enough. That was one of the few mistakes he made, and it worked out well for us."
Brewers 2, Phillies 1
Yovani Gallardo (4-1) won his third straight decision, retiring 14 straight batters in one stretch, and host Milwaukee won a day after having a dugout skirmish.
Milwaukee moved back into the NL Central lead, one game over the second-place Cubs. The Brewers had been in first place since April 21 before falling one percentage point back of Chicago on Wednesday.
Kyle Kendrick (5-2) gave up two runs and eight hits in seven innings.