NEW YORK (AP) -- Cody Ransom has bounced between Triple-A and the majors so often that he expects little when he gets called up.
Well, he might finally have found a home where he doesn't have to worry when he'll have to pack his bags again.
Ransom hit a two-run homer and a go-ahead single in the eighth inning to help the Arizona Diamondbacks beat the Mets 5-4 on Friday night, handing New York its fourth straight loss.
"Confidence is probably a big part of it, knowing that I can play here and actually believing it," Ransom said.
Ransom has only played 239 games in parts of 10 major league seasons, with stints in San Francisco, Houston, Philadelphia and with the New York Yankees . He's played 1,445 games in the minors, though, and was so frustrated during one stretch that he almost quit in 2005.
In his second year with Arizona, he was called up on April 18 and has earned more playing time. He upped his average Friday to .345 with 10 RBIs.
"He's got pop," Arizona manager Kirk Gibson said. "I hope he keeps it going."
Paul Goldschmidt hit a tying, two-run double in the eighth and Arizona won a one-run game after losing two in a row at Washington, each by a run. Arizona had lost its last nine one-run games.
"I don't think of it that way," Gibson said. "I just want to come out and win games."
The Diamondbacks were down 4-2 heading into the eighth. Justin Upton started the rally when his grounder got past Mets first baseman Ike Davis for an error.
Tim Byrdak relieved Bobby Parnell and walked Jason Kubel . A strikeout later, Mets manager Terry Collins brought in Jon Rauch (3-1) and Goldschmidt laced a two-run double. Ransom followed with an RBI single.
"It stinks tonight to let those guys down," Rauch said. "We expect to go out and do our job every time. I personally can't come in and let guys score."
Ransom hit a long homer - his third - off starter Dillon Gee in the second inning to give NL rookie of the month for April Wade Miley a 2-0 lead. But the Mets scored four times in the third - more earned runs then Miley had given up in five appearance total this season (three) coming in.
Miley gave up four runs in six innings. Brad Ziegler (1-1) allowed a hit in the seventh and David Hernandez got Josh Thole to line out to left with runners on first and third to end the eighth. J.J. Putz worked a perfect ninth for his sixth save, a day after blowing a save opportunity against Washington.
"I was happy to see him back out there," Gibson said. "I know he doesn't like what happened the other night in Washington."
Each Mets batter walked up to home plate to the beats of a Beastie Boys song in honor of the New York rap group's Adam Yauch, who died of cancer Friday at 47.
Hairston - along with teammate Justin Turner - was responsible for spurring the tribute. Hairston, who walked up to "Root Down," got the Mets on the board in the third.
After loading the bases on two hits and a walk to start the inning, Lucas Duda struck out, dropping New York to 0 for 9 with the bases full and less than two outs this season. Hairston ended that stretch with a two-run double to left. Davis had a run-scoring grounder and Andres Torres an RBI single to make it 4-2.
The Mets started off the fifth with singles that hit off Arizona infielders but Miley got a strikeout and a double play to end the threat.
"They were aggressive," Miley said. "After the third inning, we were down two. I knew if I could keep it right there we'd have a chance to come back and win it late."
Gee walked two to start the sixth but induced a groundout and struck out two to quash that threat. Gee gave up four hits - only a single after the second. He walked three and struck out six.
"Lately I've been making good pitches late in the game," Gee said. "I think I've grown as a pitcher."
Miley is in Arizona's rotation because Daniel Hudson is on the disabled list with a right shoulder impingement. Coming into Friday's start, Miley had given up only an unearned run in 12 1-3 innings as a starter over two outings.
This time, he yielded four runs and seven hits in six innings.
NEW YORK: Diamondbacks OF Chris Young (bruised shoulder) felt "a little sore swinging the bat," Gibson said. ... Hudson was scheduled to throw on flat ground Friday and then have a bullpen session Tuesday. ... The Mets honored 3B David Wright for becoming the team's career RBI leader, passing Darryl Strawberry on April 25. Strawberry presented Wright with a crystal award before the game. ... The Mets optioned right-hander Chris Schwinden to Triple-A Buffalo after he made two subpar starts in place of the injured Mike Pelfrey , and New York selected the contract of outfielder Vinny Rottino from Triple-A Buffalo.