Harvey struck out seven in six innings in his second straight solid outing, but the San Francisco Giants took advantage of a two-run error by shortstop Ruben Tejada to beat the Mets 4-1 on Tuesday night and snap a season-long five-game losing streak.

“I don’t like to lose,” said Harvey, who was drafted seventh overall in 2010. “So, obviously, I’m not happy about that. In my eyes, if he scores one run then I need to put zeros up there but I didn’t do that tonight and I didn’t do my job.”

Harvey gave up four hits, three walks and three runs — only two earned.

“As we come closer to him pitching at home, I’m sure the adrenaline is flowing pretty thick,” said Mets manager Terry Collins. “He’s enjoying his experience here. I talked to him the other day about it. He continues to believe he belongs here, and that he should have been here earlier, and that’s a great makeup to have.”

Tejada’s throw to first on the back-end of a potential double-play ball by Brandon Crawford in the second sailed into New York’s dugout fence. The error handed Harvey (1-1) a hard-luck loss and lifted San Francisco’s spirits even more on a day the franchise acquired two-time All-Star right fielder Hunter Pence from Philadelphia.

“The double-play ball we should have turned over,” Collins said. “We had another one of those innings.”

Justin Turner’s RBI double in the second was all the Mets managed off Tim Lincecum (5-11). The two-time NL Cy Young Award winner allowed six hits and one walk. He also struck out seven in seven innings in another step toward turning around the worst season of his career.

After going 4-14 with Lincecum on the mound before the All-Star break, the Giants are 3-1 when he has started since.

After almost a week of bad news, San Francisco’s fortunes started to change.

The Giants had not won since slugger Pablo Sandoval strained his left hamstring last week. That landed the All-Star third baseman on the 15-day disabled list while the rival Los Angeles Dodgers — who traded for Shane Victorino from the Phillies and Hanley Ramirez from the Marlins — turned the NL West race into a virtual tie.

The Giants sent Nate Schierholtz and two minor leaguers to Philadelphia for Pence just before the afternoon trade deadline. The Phillies were in Washington, and Pence couldn’t to make it to San Francisco in time to be in the lineup, arriving in the clubhouse just after the game.

No need on this night.

Turner doubled off the wall in left to drive home Scott Hairston and give the Mets a 2-1 lead in the second inning. Hairston, whose two home runs powered the Mets past San Francisco 8-7 in 10 innings on Monday night, singled with one out to jumpstart the offense again.

Defense failed New York this time.

After Justin Christian grounded into a force at home plate with the bases loaded and no outs in the second, Brandon Belt grounded into what appeared to be a routine double play. Instead, Tejada’s throw overshot first baseman Ike Davis for an error that put San Francisco ahead 2-1.

The Giants loaded the bases again in the sixth and Harvey squeezed out of the jam in similar fashion. Marco Scutaro grounded into a double play to score Ryan Theriot and added a two-out RBI single in the eighth to extend San Francisco’s lead to 4-1.

Lincecum rallied from a bases-loaded jam in the seventh. The shaggy-haired right-hander got Josh Thole to line out to second and struck out pinch-hitter David Wright on a curveball left him in the batter’s box stunned.

Mets outfielders Jason Bay (stiff left calf) and Andres Torres (strained right thumb) sat out with injuries and third baseman Wright was initially given the night off. Bay pinch-hit in the ninth and grounded out to end the game.

Giants center fielder Angel Pagan sat out with a bruised left hand.

Notes: Mets GM Sandy Alderson decided not to part ways with Hairston or any other players before Tuesday afternoon’s trade deadline. “We haven’t given up on the season,” Alderson said. “We didn’t move players off the team for a reason. We think we have lots of good baseball in front of us, and Scott can be part of that.” … Mets closer Frank Francisco (strained left side) struck out all three batters he faced during a rehab assignment for Double-A Binghamton.

Have you lost faith in the Mets’ chances? Be heard in the comments below…

(TM and Copyright 2012 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2011 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)