Headley drew a bases-loaded walk with two outs in the 11th, two innings after his throwing error cost Heath Bell the save that would have set a franchise record.
Bell allowed three runs in the ninth, squandering a chance at his 42nd straight save. The second and third runs that inning came in on Headley's two-out throwing error from third base.
|More on D-Backs at Padres|
"You hate when something like that happens, especially in the situation it did," Headley said. "But after it happens, you've got to throw it away and you've got to continue battling. I'm really glad we were able to finish it off with a win because that didn't feel very good."
Bell was trying to move out of a tie with Trevor Hoffman and one-time Padres closer Rod Beck to take sole possession of fourth place on the all-time list for consecutive saves.
"If I hadn't have walked people, we wouldn't have been in that situation at all," Bell said. "I blame myself tonight, not anybody else. Chase basically won the game for us. That error right there wasn't even crossing my mind.
"A lot of things have to go right to get a lot of saves in a row. The streak's over. We can stop talking about it, I guess. Start up another one, you know? I'm glad we won. At the end of the day, that's the most important thing."
Bell got in trouble from the start by issuing consecutive walks to Ryan Roberts and Juan Miranda before Gerardo Parra hit an RBI double to right-center. With runners on second and third, Bell struck out pinch-hitter Russell Branyan and Chris Young before Kelly Johnson hit a grounder to Headley.
He threw a one-bouncer to first baseman Brad Hawpe, who had such a hard time getting a handle on the ball that both Miranda and Parra scored to tie it.
"I just threw it into the ground," Headley said. "I mean, 99 out of 100 times I make that play. I felt like I did everything I needed to do, and I just spiked it."
The Padres, who left the bases loaded in the 10th, started the winning rally against Sam Demel (1-2) when pinch-hitter Chris Denorfia beat out an infield single and Will Venable singled for his third hit. The runners advanced on Jason Bartlett's groundout and Ryan Ludwick reached on catcher's interference to load the bases. Headley walked on a full-count pitch.
"We lost the game. We walked  guys," Arizona manager Kirk Gibson said. "We walked the winning run in."
Chad Qualls (1-2) pitched two innings for the win.
It was San Diego's first game against Arizona since Kevin Towers took over as the Diamondbacks' general manager. Towers was San Diego's GM for 14 seasons before being fired at the end of the 2009 season.
San Diego starter Tim Stauffer remained winless in seven starts despite allowing four hits and striking out six in 6 2/3 scoreless innings while walking one. Stauffer has allowed two runs or fewer in six of seven starts.
The Padres finally scored some runs for Stauffer. Coming in, the Padres had scored only seven runs in Stauffer's 34 2/3 innings pitched for 1.82 runs, the third-lowest average in the majors among qualifying pitchers.
San Diego used small ball to score two runs against Armando Galarraga. Eric Patterson drew a leadoff walk and took third on Rob Johnson's single to center. Patterson scored on a safety squeeze by Stauffer, who ended up on second on an error by second baseman Kelly Johnson, who let the throw from Galarraga skip past him. Johnson then scored on Venable's sacrifice fly.
The Padres weren't nearly as sharp the next inning. With runners on second and third and one out, Patterson popped up a bunt to catcher Miguel Montero. Rob Johnson was intentionally walked to load the bases and Stauffer struck out.
Headley's single in the fifth brought in Venable, who hit a leadoff double and advanced on Bartlett's groundout.
Galarraga went 4 1/3 innings, allowing three runs, two earned, and three hits. He walked six and struck out two.
- The Padres placed C Nick Hundley on the 15-day disabled list because of a strained muscle in his right side. The Padres purchased the contract of C Kyle Phillips from Double-A San Antonio to serve as the backup to Rob Johnson. Hundley's move is retroactive to Thursday.
- The Padres transferred infielder Jarrett Hoffpauir from the 15- to the 60-day disabled list to make room on the 40-man roster.