New York Mets' Ike Davis, left, and Scott Hairston, center,...

New York Mets' Ike Davis, left, and Scott Hairston, center, celebrate as Ruben Tejada, second from right, scores the game-winning run as San Francisco Giants' Buster Posey, right, looks on during the ninth inning. (April 21, 2012) Credit: AP

The Mets held their annual Bark at the Park festivities Saturday, allowing fans to walk their leashed dogs around the Citi Field warning track minutes before Mike Pelfrey tossed the first pitch.

Turns out they had their own little mess to clean up hours later.

Kirk Nieuwenhuis channeled his inner Luis Castillo, failing to glove a potential game-ending pop-up. That allowed the Giants to score two runs and tie the game, drawing immediate comparisons with Castillo's game-ending botched attempt against the Yankees three years ago.

But unlike that fateful night in the Bronx, the Mets found a way to avoid what would've been a heartbreaking loss after blowing a three-run lead in the ninth.

Thanks to Scott Hairston's takeout slide, Ruben Tejada scored the winning run in the bottom of the ninth on catcher Buster Posey's throwing error as he tried to complete an inning-ending double play, handing the Mets a wild 5-4 victory that almost defied logic.

"At this level," manager Terry Collins said, "you are going to escape death a few times and sometimes you are going to get shot. Today, fortunately, we escaped it."

With a little assistance from Hairston and a fielding gaffe by the Giants.

The Mets loaded the bases with one out in the ninth on Justin Turner's one-out grounder to shortstop, a ball that could've been turned into a double play. Shortstop Emmanuel Burriss was going to try to turn two, but he had to go to first when he looked at second base and no one was covering. Turner beat the throw.

Nieuwenhuis hit a chopper to first that Aubrey Huff fielded and threw home in plenty of time to nab pinch runner Hairston. But after Posey touched the plate for the forceout, Hairston slid into his right leg just as Posey was throwing the ball to first. That caused the ball to sail off target and into rightfield, allowing Tejada to score the winning run.

Posey, who was involved in a horrific collision at the plate last year that cut his season short, argued with plate ump Doug Eddings as the Mets celebrated their second walk-off win of the season.

"It's a clean play, 100 percent," Hairston said. "My job after that, once I'm out, I'm still running and I can still do something to make him not throw the ball correctly.

"It's just part of the game. It's one of those things where I know he's dealt with a tough injury, and I have a lot of respect for him and I have a lot of respect for the game not to hurt anybody. But my job as a baserunner is to make sure the throw is altered in that situation. I didn't raise my spikes in any way. I made sure it was low and I was able to hit the bottom of his foot and not his ankle, and make sure he wasn't hurt at all."

The Mets had coughed up a three-run lead in the ninth, partly because closer Frank Francisco couldn't get the job done for a second straight day and third straight game. He surrendered a run and had runners on first and second when Collins gave him the hook, bringing in relievers Tim Byrdak and Jon Rauch to try to nail it down.

Rauch had two strikes on Brandon Belt when he hit a pop to shallow center. Tejada and Nieuwenhuis converged and Nieuwenhuis called off Tejada once he saw the wind was blowing the ball farther into the outfield.

"I was playing deep," said Nieuwenhuis, who added that he didn't lose it in the sun. "I was playing no-doubles there. It was a high fly ball and I just overran it. I was coming from a long way out and that's my ball all the way. I just overran it."

Tejada said it's a play that had to be made. "It was a lot of wind out there," he said, "but you have to catch that [ball] in that situation. It's the ninth inning."

The Mets won anyway, which might help Nieuwenhuis' psyche somewhat.

"You can't let it stick with you," he said. "You feel the emotion today, but we came out on top. You flush it and get ready for tomorrow."