SAN FRANCISCO -- Joc Pederson turned a pair of pregame chats with home run king Barry Bonds into the best night of his career.
Pederson homered three times and drove in a career-high eight runs, including a tying single with two outs in the ninth inning, and the San Francisco Giants outslugged the New York Mets 13-12 on Tuesday in one of the wildest games imaginable.
"Just getting knowledge from such a good hitter and the way he thinks about baseball and hitting, it just helped to connect some dots to free my mind up at the plate,'' Pederson said. "I'm not ever going to be Barry Bonds; he's the best hitter to touch a bat. But it definitely helped free my mind up in the box.''
Francisco Lindor homered and drove in six runs for the Mets, including a bases-loaded triple that put them ahead in a seven-run eighth.
Pederson was preparing for the game when he and teammate LaMonte Wade Jr. spent 30 minutes with Bonds in the Giants' clubhouse. Pederson and Bonds chatted again in a private office before Pederson politely excused himself.
"The next thing you know, it was like 6:25 p.m., and I was like, 'I gotta go,''' Pederson said.
San Francisco squandered an 8-2 cushion by giving up two runs in the seventh and seven in the eighth to fall behind 11-8. Pederson tied it with a three-run homer in the bottom half, but the Giants trailed 12-11 in the ninth before rallying with two outs and none on to stun New York and end their five-game losing streak.
"He was joking about it after his first one, about talking to Barry,'' Giants starter Logan Webb said of Pederson. "Then he hit the second, then he hit the third, and it was like, man, this guy is something else. You're not going to cheat him with anything. He's trying to do that every at-bat.''
Pederson launched a pair of two-run homers off Mets starter Chris Bassitt. San Francisco's slumping cleanup hitter then crushed his third homer of the night, a three-run drive into McCovey Cove off reliever Drew Smith with two outs in the eighth to erase New York's 11-8 lead.
"He had a good night against us,'' Mets manager Buck Showalter said of Pederson. "We missed a lot of locations with fastballs tonight. That's not the way we've been doing it for the most part, so tonight was a challenge for us.''
Pederson was 4-for-46 in May before his big outing.
"It was probably the best individual offensive performance that I've ever been around, considering all things like big moments in the game and the necessity to be resilient even in that last at-bat,'' Giants manager Gabe Kapler said.
But in the bottom half, Mike Yastrzemski walked with two outs, and Darin Ruf singled. Pederson's single tied it, and Crawford, who struck out three times earlier, followed with a sharp single off Diaz (1-1) that drove in Ruf.
It was the third blown save for Diaz.
John Brebbia (2-0) got the win.
The loss prevented the Mets (29-16) from being the first National League team to reach 30 wins. The New York Yankees were the first American League team to do it, having beaten the Baltimore Orioles earlier in the day.
Eduardo Escobar had four hits for the Mets, who put together their latest big comeback before falling short. New York scored five runs in the ninth inning of a 5-2 win at the St. Louis Cardinals on April 25 and seven in the ninth for an 8-7 victory at the Philadelphia Phillies on May 5.
Giants reliever Tyler Rogers allowed four consecutive singles to open the eighth, and Dominic Smith's two-run single made it 8-6. After Mark Canha was caught in a rundown between third and home, Nimmo reached on an infield single, and Starling Marte singled in a run to load the bases.
Lindor followed with a sharp liner into the left-field corner, and Pederson briefly fumbled the ball as all three runners scored. Pete Alonso added a sacrifice fly.
Tommy La Stella hit a three-run homer for the Giants (23-19). His second this season also came off Bassitt, who was tagged for a career-high eight runs in 4⅓ innings.