Eric Young scored the go-ahead run on an error in the top of the 16th inning, as the New York Mets outlasted the San Francisco Giants, 4-3, in the first of three games at AT&T Park.
Young hit a one-out single off George Kontos (2-2), stole second and moved to third on a 4-3 grounder. After Javier Lopez intentionally walked David Wright, pinch-hitter Anthony Recker grounded a Lopez pitch that shortstop Brandon Crawford booted, allowing Young to score.
The Giants put two men on base with one out in the home half of the 16th, but Bobby Parnell earned his 16th save by striking out Pablo Sandoval and getting a pinch-hitting Guillermo Quiroz to bounce into a game-ending fielder's choice.
"We just hung in there," said Mets manager Terry Collins.
Josh Edgin (1-1) tossed two innings to collect the win, the Mets' third in the last four games.
The Giants, who have dropped six of seven, stranded a runner in scoring position in the 11th and 12th innings and left the bases loaded in both the 13th and 15th.
Buster Posey went 5-for-8 with two doubles and a two-run homer for the Giants, who went 1-for-15 with runners in scoring position and left 18 men on base.
"This is as frustrating a game as we've had," said Giants manager Bruce Bochy.
Crawford had three hits with an RBI and stole at least one run away from the Mets when he dove in the hole and threw out Marlon Byrd to leave two in scoring position in the 11th.
Matt Harvey, trying to make his case for starting next week's Midsummer Classic in front of Bochy, the NL All-Star manager, had a similar line to that of his counterpart, Tim Lincecum. Both starters allowed three runs on six hits and a walk over seven innings, with Harvey adding to his NL-leading total with six strikeouts and Lincecum fanning a season-high 11.
Neither factored in the decision after Hunter Pence, one of five NL finalists for MLB's Final Vote, tripled high off the right-field wall leading off the seventh and scored the tying run on Crawford's comebacker through the middle.
Posey turned on a fastball and took Harvey deep over the left-field wall in the first inning with fellow All-Star Marco Scutaro on first following his one-out single.
John Buck's RBI double in the fifth inning halved New York's deficit, and the Mets pushed two across in a forgettable sixth for San Francisco's defense.
Young opened the frame with a triple into the left-field corner and scored when a sliding Andres Torres had Daniel Murphy's sinking liner carom off the heel of his glove.
Wright followed with an infield single, and Murphy advanced to third on Scutaro's throwing error, proving vital after Murphy scored the go-ahead run on Ike Davis' double-play grounder.
Harvey, who threw 121 pitches, has 147 strikeouts and 15 quality starts this season. He is just the fourth pitcher in Mets history to make the All-Star team in his first full season in the majors ... Lincecum has just one win in his last 10 starts ... The Giants lost their seventh straight series opener ... San Francisco first baseman Brandon Belt went 0-for-8 with five strikeouts ... Game time: 5:26.