DENVER (AP) -- Wil Myers knew the instant the ball thumped his bat. He's just in that kind of groove at the moment.

Myers hit a two-out, three-run homer in the ninth inning off closer Jake McGee, helping the San Diego Padres rally for a 7-5 win over the Colorado Rockies on Friday night.

Myers lined a 3-2 fastball from McGee (0-2) over the fence in center, capping a four-run inning.

More from FoxSports

"I'm seeing the ball well," Myers said. "I just want to ride this out as long I can and keep going."

Trailing 5-3 and down to their last out, Alexei Ramirez and Alexi Amarista singled, followed by an RBI double from Jon Jay. The Rockies caught a break when Jay's ball bounced over the fence in left for a ground-rule double because it forced Amarista back to third when he easily would've scored the tying run.

It didn't matter as Myers followed with his sixth homer of the month.

"I was just lucky enough to get a good pitch and put a good swing on it," Myers said. "But those guys right there really got it started."

Kevin Quackenbush (3-2) threw two innings for the win and Fernando Rodney picked up his 12th save by retiring the Rockies in order to end the game.

The Padres suffered an early blow when starter Andrew Cashner left with upper back and neck tightness after throwing six pitches. He was bothered by it while warming up and manager Andy Green didn't want to take any chances.

"I thought it was best to get him out of there," Green said. "We'll see how he wakes up tomorrow and figure out what we need to do."

Reliever Luis Perdomo filled in and allowed four runs, three earned, over 5 2/3 innings.

Jon Gray pitched seven solid innings, allowing three runs, one earned, and striking out seven in a hard-luck no decision. He was in line for his fourth straight win before the meltdown in the ninth.

"Anytime you lose in the ninth when you've led all night, yeah, those are tough losses," manager Walt Weiss said. "Jon was real good again, certainly did his part."

Melvin Upton Jr. hit a homer in the fourth. It was his first since May 14.

Once Gray left with a 4-3 lead, he had to anxiously watch the bullpen go to work. Carlos Estevez found himself in a jam in the eighth with runners on first and third and one out. He struck out Matt Kemp and then intentionally walked Yangervis Solarte to get to Upton, who struck out on a 99-mph fastball to end the threat.

McGee couldn't wiggle off the hook. It was his third blown save of the season.

"Just a few singles and a hit down the line and it snowballed a bit," McGee explained.

Nolan Arenado hit a two-run homer in the first for his NL-leading 19th of the season.

TRAINER'S ROOM

Padres: RHP Jon Edwards (right flexor strain) will have a platelet-rich plasma (PRP)/stem cell injection in his elbow and be shut down for eight to 10 weeks. "The hope is he's able to pitch by the end of the year," manager Andy Green said. ... RHP Tyson Ross (shoulder inflammation) is playing long toss. "He's moving toward where we want him, which is on the mound," Green said.

Rockies: RHP Adam Ottavino (Tommy John surgery) was scheduled to throw Friday at Class A Modesto. "We have (his rehab game schedule) mapped out. It's for an entire month," Weiss said. "He's going to be a while."

QUIETING KEMP

This was a major achievement: The Rockies kept Kemp silent at the plate and struck him out four times. Over the years, he's crushed Colorado pitching.

His 182 hits, 41 homers and 140 RBIs against the Rockies are the most among active players.

Asked if he had a strategy for Kemp, Weiss responded: "I'm all ears if you've got one."

UP NEXT

Padres: RHP Erik Johnson (0-2) makes his San Diego debut Saturday after being acquired in the deal that sent James Shields to the Chicago White Sox. Johnson had a 6.94 ERA in two starts with the White Sox this season.

Rockies: RHP Tyler Chatwood (7-4) has found success on the road -- a major league-best 0.65 ERA -- but struggles at Coors Field, where he's 2-4 with a 5.30 ERA heading this season into Saturday.