Ransom hit a two-run homer in the second inning but Arizona trailed 4-2 heading into the eighth. Paul Goldschmidt delivered a two-run double in that inning to tie the contest and Ransom singled in Goldschmidt with the winning run.
Arizona halted a two-game losing streak while the Mets lost their fourth in a row.
Jon Rauch (3-1) was on the mound during the Arizona rally in the eighth and took the loss.
All of New York's runs came in the third inning, two on a double by Scott Hairston.
Beautician charged with giving client fatal silicone butt injection
Attkisson leaves CBS News, reportedly over network's 'liberal bias'