DENVER -- Chris Nelson wasn't sure he had hit the ball hard enough for a homer.
When he saw the saw ball disappear over the fence as he rounded first base, out came a celebratory fist pump, and a day marked by frustration at the plate and in the field turned noticeably bright.
"I was hustling out of the box, but I got it pretty good and I was thinking triple out there," said Nelson, who was still fuming over his strikeout in his previous at bat as well as what he considered his sloppy fielding of a grounder to third base that Cameron Maybin beat out for an infield hit in the Padres' three-run fourth.
"The day wasn't going the best for me, just wasn't going well, and it all came out at once," Nelson said. "I've had a couple (of game-winning homers) before but none like that one. It's a great feeling, a great feeling to be up at the plate with guys in scoring position and to get them all in."
"Everybody is just doing their job. Everybody is doing what they need to do to get the win at the end of the day," Nelson said.
Headley drove in at least one run with each of his four hits, including his 23rd homer of the season, a two-run shot in the first inning. Alexi Amarista had a career-best five hits for the Padres, who had a season-high 20 on the day.
"I was swinging good. I found some holes, hit a couple of balls hard, hit a couple not as hard and was able to find the holes today," Headley said. "I had a lot of opportunities with guys on base. It makes my job a lot easier when there is a lot of pressure on the pitcher."
With San Diego leading 9-7 in the bottom of the seventh, Tommy Layne hit Carlos Gonzalez with a pitch, Jordan Pacheco singled, and one out later Nelson homered to straightaway center against Brad Brach (1-4). It was Nelson's seventh home run of the season.
"I was trying to throw a slider down and away and out of the zone," Brach said. "I left it up, he made a good swing on it and hit it out."
Rockies manager Jim Tracy said Nelson has been swinging the bat well recently.
"The ball has been on the barrel of his bat regularly lately," Tracy said of Nelson, who has had at least one RBI in four of his last five games.
Colorado added a run in the eighth, with help from a two-base throwing error by Brach that allowed Charlie Blackmon, aboard with a walk, to advance to third. Fowler drove him in with his third hit of the day and second RBI single.
Guillermo Moscoso (1-1) retired the only batter he faced to close the seventh, and Rafael Betancourt gave up three consecutive two-out hits in the ninth -- including an RBI single by Amarista -- before getting Chris Denorfia to ground out for his 27th save.
The Rockies recovered to get the win after giving up a four-run lead following a seven-run third inning.
San Diego's Casey Kelly, who pitched six scoreless innings to beat Atlanta in his major league debut last Monday, was roughed up when the Rockies sent 11 men to the plate in the third.
Fowler singled to drive in the inning's first run for the Rockies and after a two-out, ground-rule double by Gonzalez, Pacheco hit a two-run double to tie the score at 3-all.
Colvin followed with a drive into the right-field seats for his 17th home run of the season and second in two games. After Nelson singled, Hernandez connected for a two-run shot, his first homer since April 27, ending a drought of 121 at-bats.
Staked to the 7-3 lead after trailing 3-0 early, Rockies starter Jeff Francis couldn't get out of the fourth inning. He allowed six runs on 10 hits in 3 2/3 innings, including Headley's two-run homer in the first and RBI single in the third. Headley's two-run single in the fourth helped the Padres pull to 7-6, finishing Francis and bringing on reliever Adam Ottovino.
After Amarista doubled in the sixth and scored on Logan Forsythe's single, Headley hit his third run-scoring single of the day and the Padres went in front 9-7.
Rockies SS Troy Tulowitzki, on the disabled list since May 30 with a groin injury, was slated to play 5- and 7- innings Sunday and Monday at Triple-A Colorado Springs as part of a minor league rehab assignment. He'll be re-evaluated on his return. ... The Padres move on to Los Angeles, where LHP Andrew Werner (1-1) will pitch the opener Monday against the Dodgers' RHP Joe Blanton (9-12). ... Colorado heads to Atlanta and RHP Tyler Chatwood (4-3) is set to start against the Braves' RHP Kris Medlen (6-1). ... Pacheco extended his hitting streak to 11 games. ... The Padres previous season high was 18 hits on May 24 against the New York Mets. ... Amarista's five-hit game was the first by a Padre this season.