SAN FRANCISCO (AP) -- Scott Hairston planned to relax and watch a little television when he got back to the hotel. He'll go sleep thinking he will remain with New York the rest of the season.
''I can't predict the future but I'm content where I'm at,'' Hairston said of trade rumors. ''I'm expecting to be in the dugout tomorrow.''
Hairston hit his second homer of the game, connecting in the 10th inning to send the Mets past the reeling San Francisco Giants 8-7 Monday night.
The Giants have lost five in a row, all at home, and were coming off a sweep by Los Angeles. San Francisco still leads the NL West by one percentage point over the Dodgers.
Hairston hit a two-run homer in the eighth as the Mets scored four times for a 6-4 lead. Buster Posey and Nate Schierholtz had RBI doubles in the Giants ninth to tie it.
''A lot of things happened in that game,'' Giants manager Bruce Bochy said. ''We swung the bats better but we also made mistakes that came back to get us.''
Hairston hit a solo homer in the 10th off Santiago Casilla (4-5) and the Mets scored again on an error. The Giants got a run in their half before Manny Acosta earned his first save.
''We've had a lot of late-inning rallies, a lot of two-out hits,'' Mets manager Terry Collins said. ''For two years in a row Manny has been an outstanding pitcher. I told him to relax and make some pitches.''
Josh Edgin (1-0) got his first major league victory.
Hairston hit a tying homer in the eighth and pinch hitter Justin Turner and Rob Johnson also drove in runs in the inning against Sergio Romo.
Hairston has 14 home runs against the Giants, his most versus any team. Romo was tagged for four runs, matching what he had allowed in his previous 30 2-3 innings.
''I just try to do the best I can against everybody,'' Hairston said. ''It just happens to be the Giants I have a lot of success against.''
Bobby Parnell gave up Posey's double and Edgin allowed Schierholtz's tying hit, giving the Mets their 17th blown save.
Ronny Cedeno added two RBIs for the Mets. Marco Scutaro and Ryan Theriot each had two hits and drove in a run for the Giants.
Giants starter Madison Bumgarner gave up two runs on six hits over six innings. He walked two and struck out nine.
Mets starter Jeremy Hefner allowed four runs on 10 hits over 5 2-3 innings. He walked three and struck out five.
Scutaro's sacrifice fly in the third gave the Giants a 1-0 lead.
NOTES: Mets OF Mike Baxter was activated from the disabled list after OF Kirk Nieuwenhuis was optioned to Triple-A Buffalo following Sunday's game in Arizona. ... Andres Torres has hit safely in 11 straight road games. ... Cedeno's double was the Mets' 201st of the season, which trails only the Boston Red Sox. ... Two-time Cy Young Award winner Tim Lincecum (4-11, 5.88) goes for the Giants on Tuesday night. He's beaten the Mets in his last four starts against them. ... RHP Matt Harvey (1-0, 0.00) will make his second major league appearance for the Mets. ... Aubrey Huff recorded his first RBI since June 2. ... Mets OF Jason Bay ended a 0-for-23 streak with a sixth-inning single, just shy of his career worst 0-for-24. ... Matt Cain became the first Giants pitcher to score a run as a pinch runner since Brad Hennessey in 2008.