Michael Conforto, who has struggled in limited at-bats against lefthanders, reached base for the third time when he walked leading off the ninth against lefty Josh Osich (0-1). T.J. Rivera fouled out, Jay Bruce flied out and Wilmer Flores singled off reliever Hunter Strickland's calf.
Walker singled into the right-field corner, and the Mets ran out of the dugout to swarm him in celebration. Conforto scored for New York's first walk-off win this season, giving the Mets their seventh victory in 10 games.
Jeurys Familia (1-0) needed just five pitches in a perfect ninth, finishing a five-hitter started by Jacob deGrom, who struck out 11 in six innings.
New York has been dealing with drama all homestand, from an injury that will likely keep star pitcher Noah Syndergaard out until after the All-Star break to a suspension of pitcher Matt Harvey, who failed to show up for a game.
San Francisco, which has lost five of six, was playing at Citi Field for the first time since beating the Mets 3-0 last Oct. 5 in the NL wild-card game. Conor Gillaspie hit a three-run homer in the ninth off Familia, and Madison Bumgarner pitched a four-hitter to outlast Syndergaard.
"It's a great memory," Giants manager Bruce Bochy said before the game. "You savor. You never let go."
But San Francisco entered an NL-worst 11-21 after getting swept at Cincinnati in a weekend series and getting outscored 31-5, the Giants' worst run differential in a three-game series since 1894 against Boston, according to the Elias Sports Bureau.
"You've got to be careful that you do assume the attitude that, hey, we'll be fine. We'll be fine," Bochy said. "But, we're not fine now, and it's time for us to do something."
Hunter Pence hit a two-run homer in the first, only his second extra-base hit since April 10, and Buster Posey hit a solo shot deep into the left-field second deck in the sixth. Both were off deGrom, who reached double-digit strikeouts for the fourth time in five games. He allowed four hits.
Matt Moore remained 1-5 on the road since throwing 133 pitches at Dodger Stadium on Aug. 25, when he pitched 8 2/3 hitless innings before Corey Seager's single. Moore allowed Walker's RBI double in the first and Rivera's tying double in the fifth. Pinch hitter Curtis Granderson tied the score 3-all in the sixth with a run-scoring double off George Kontos.
Terry Collins managed his 1,003rd game with the Mets, tying Bobby Valentine for second on the franchise list behind Davey Johnson (1,012).
Giants: SS Brandon Crawford, on the DL since April 26 because of a strained groin, was 1 for 3 with a double in six innings for Double-A Richmond and could be activated Tuesday. INF Aaron Hill (right forearm strain) had an MRI that according to Bochy "still shows something going on the forearm; he's not as close as we were hoping." Hill has been on the DL since April 24. CF Denard Span (sprained shoulder) is to start a rehab assignment Tuesday with Class A San Jose.
Mets: After a day at DH, Lucas Duda (hyperextended left elbow) played five innings at first base for Class A St. Lucie and was 1 for 2 with a walk at the plate. SS Asdrubal Cabrera (left thumb) was out of the starting lineup for the second straight game but pinch hit with the bases loaded in the eighth and grounded into an inning-ending double play.
Giants RHP Jeff Samardzija (0-4) is scheduled to start Tuesday night against Mets RHP Zack Wheeler (1-2). On May 3 at the Los Angeles Dodgers, Samardzija allowed an unearned run and three hits in the Giants' 4-1, 11-inning win, striking out 11 and walking none.