Nido -- Ramos' backup who entered as a pinch-hitter in the 11th -- drove a 2-0 pitch from Farmer (3-4) just beyond leaping center fielder JaCoby Jones at the wall in right-center, ending a game full of wasted chances for both teams. Nido was doused with water at home plate, and Noah Syndergaard dumped a jumbo bag of popcorn over his head during an on-field postgame interview following the 25-year-old's third career homer.
It was Nido's first walk-off hit since high school.
"That was an unbelievable feeling," he said.
New York has won five of six at Citi Field this week despite trailing in all but one of those games. That came after the front office spoke up Monday to defend embattled second-year manager Mickey Callaway. The Mets (25-26) can climb back to .500 with a win Sunday.
Ramos drove in four and had New York's only three hits through eight innings, including a go-ahead, two-run shot in the sixth. He has three homers in two days, bringing his total to five for the season.
"I've been working really good in the cage right now," he said. "I'm getting my timing back."
It's only the second time in franchise history two catchers homered in the same game, following Gary Carter and Ed Hearn in 1986.
"It was like Mike Piazza back there or something," Callaway said.
All-Star closer Edwin Diaz entered with New York leading 4-3 in the eighth seeking his first four-out save of the season -- his first stab at one since Callaway changed his tune on using Diaz for more than three outs days earlier. Diaz replaced Robert Gsellman with a runner on third and quickly allowed a tying single to Jones for his first blown save as a Met. Diaz had converted 22 straight save chances dating to last season, including 12 this year.
Wilmer Font replaced Diaz to start the ninth and pitched through the 10th, freezing Jones with a 3-2 curveball to strand two runners.
Detroit left-hander Daniel Stumpf pitched out of a one-out, bases-loaded situation in the 11th, and New York's Hector Santiago (1-0) escaped an identical jam in the 12th with a strikeout and a flyout.
Detroit was 1 for 13 with runners in scoring position and stranded 14.
"We had our opportunities," manager Ron Gardenhire said.
Gardenhire used 20 players for the second time in his 13-season managerial career. He also used 20 while leading Minnesota over Milwaukee 6-5 in 14 innings on May 28, 2013.
"We don't get involved in stuff like this too often," Gardenhire said.
Dawel Lugo had a career-high four hits for Detroit, which has dropped 10 of 11 after ending a nine-game skid Friday.
Tigers left-hander Ryan Carpenter threw five efficient innings, allowing two runs and two hits over 56 pitches in his third career start, but he left trailing thanks in part to consecutive balk calls against him in the fourth. The balks advanced J.D. Davis from first to third after he reached on Lugo's error at third, and Davis then scored on Ramos' single.
Carpenter was initially confused by what triggered the infractions, and Gardenhire argued with crew chief Jerry Meals and second base umpire Ron Kulpa before having words with Carpenter. The issue was that Carpenter was coming to the set position twice.
"I had to explain to him, you just have to fix it right now or they're going to keep calling balks," Gardenhire said. "He didn't really understand it at first, but then he got it and did fine."
Gardenhire said Carpenter will remain in the rotation, with Gregory Soto going to Triple-A Toledo to make his next start.
Mets starter Jason Vargas navigated trouble effectively throughout his return from the injured list with a strained left hamstring. He had a runner on base in each of his five innings but limited Detroit to a run and five hits.
Tigers: INF Jordy Mercer was set to begin an injury rehab assignment with Toledo. Mercer has been out since May 9 with a right quad strain.
Mets: OF Michael Conforto again participated in baseball activities, and New York hopes he'll clear Major League Baseball's concussion protocol to return Sunday. ... INF Luis Guillorme was sent to Triple-A Syracuse to make room for Vargas, leaving New York with just 12 position players.
Detroit starts another rookie, RHP Spencer Turnbull (2-3, 2.68), against New York RHP Zack Wheeler (3-3, 4.74). Turnbull entered Saturday third among qualified rookie starters in ERA and strikeouts (54).
Follow Jake Seiner: https://twitter.com/Jake-Seiner
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Wong starts double play in style
Kole Calhoun hits a soft grounder to second, where Kolten Wong quickly shovels ball with glove to second to start a double play.
Rookie trifecta: Smith delivers 3rd straight walk-off for LA
Hours after being called up from the minors, Will Smith connected for a pinch-hit, three-run homer with two outs in the ninth inning that lifted the Los Angeles Dodgers over the Colorado Rockies 6-3 Sunday.
Locastro wins it, D-backs end six-game losing streak
Tim Locastro's single with the bases loaded in the 10th inning gave the Arizona Diamondbacks a 3-2 win over the San Francisco Giants on Sunday.
Crawford shines, Kikuchi rebounds as Mariners thump O's 13-3
J.P. Crawford had a career-high four hits and drove in four, Yusei Kikuchi had his best outing in a month, and the Seattle Mariners used an eight-run third inning to thump the Baltimore Orioles 13-3 Sunday.
Rays' big 4th inning leads to 8-2 win vs. A's
The Rays rack up five runs in the 4th inning to fuel an 8-2 win over the A's.
Bellinger hits fan with foul ball
Cody Bellinger rips a ball past the netting and hits a fan in the face.