PHOENIX -- Jake Peavy's monthlong stay on the disabled list is fading into memory.
"I was definitely better than I had been my previous couple of starts," said Peavy, sidelined for just under a month in May and June with the sore elbow. "I'm getting back to where if I have decent stuff I'm going to do much better than I have."
Adrian Gonzalez also homered for the Padres, who have won two straight after dropping 10 of their previous 11.
Stephen Drew homered for the Diamondbacks, who lost for the fifth time in eight games to fall two games under .500 for the first time this season.
"It's just kind of the same old theme here," Arizona manager Bob Melvin said. "They get a couple of runs and we have a hard time coming back. We just have to start playing better. We have to start scoring runs, getting some good at-bats and getting a different feeling from the group. We don't have as confident a look in our eye."
Peavy (6-5) allowed just three hits, walked two and struck out six. After walking Miguel Montero with one out in the second, the reigning Cy Young Award winner retired the next 14 batters.
"I battled through the first two but then I found my groove and did what I do best, which is throwing strikes and staying ahead of the hitters," Peavy said.
Trevor Hoffman allowed Drew's one-out homer into the Padres' right-field bullpen in the ninth and a two-out single to Montero before recording his 16th save.
Arizona starter Doug Davis (3-4) gave up seven hits in a season-high eight innings. He couldn't overcome the two pitches thrown to Hairston.
"If you're going against somebody like Peavy you've got to put zeros up there," Davis said. "You know it's going to be a low-scoring game with Peavy out there. It was just two mistakes and Scotty's a guy where if you leave something up in the zone he's not going to miss it."
Luke Carlin led off the third inning with a single and Hairston followed one out later with a home run into the spa beyond the fence in right-center to give San Diego a 2-0 lead.
Hairston led off the sixth with his second homer, a fly a half-dozen rows into the left-field stands.
"When you come back against a former team you want to do well," said Hairston, traded by Arizona to San Diego last July 27. "I think I didn't perform to my capabilities when I was given a chance (in Arizona). There you have it. If it's anybody's fault, it's mine."
Hairston has two two-homer games this season.
"Scotty's one of those guys that when he gets hot, he gets hot," Padres manager Bud Black said. "Last night he pinch-hit and got the double and he carried it over to today with three straight hits."
Gonzalez made it 4-1 in the ninth when he homered off Tony Pena.
Drew's homer pulled Arizona back within two in the ninth.
The Diamondbacks, who entered 13th in the NL in hitting, stranded four runners the first two innings.
In the second, Chris Young hit a one-out double and Montero walked but Davis popped up a sacrifice attempt and Peavy struck out Emilio Bonifacio.
"I just can't stand giving up runs early and getting down early," said Peavy, who needed 48 pitches the first two innings and 59 the rest of the way. "You feel like you're digging yourself out of a hole the rest of the night."
- Hoffman has allowed seven homers in 28 innings.
- Arizona reliever Juan Cruz left in the ninth with a strained left oblique after throwing three pitches to Gonzalez. Melvin said the right-hander may be headed for the disabled list.
- Hairston also hit two homers April 29 at Philadelphia.
- Peavy snapped a two-game losing streak against Arizona and raised his career record against the Diamondbacks to 11-10.
- Hudson pulled up limping halfway between first and second on his double with an apparent right leg injury but remained in the game.
- After starting the season 17-5 against the NL West, the Diamondbacks have lost five of their last eight division games.