SAN FRANCISCO (AP) -- With the bases loaded in the seventh inning and everything riding on Tim Lincecum's latest big start, the skinny right-hander with the funky delivery dropped a wicked curveball against pinch-hitter David Wright that landed near the knees to freeze the All-Star third baseman in the batter's box.
One step closer to The Freak's funk being over, too.
Lincecum struck out seven in seven innings and the San Francisco Giants took advantage of a two-run error by shortstop Ruben Tejada to beat the New York Mets 4-1 on Tuesday night and snap a season-long five-game losing streak.
After going 4-14 with Lincecum on the mound before the All-Star break, the Giants are 3-1 when the two-time NL Cy Young Award has started since.
''He pitched like the Timmy we know,'' Giants manager Bruce Bochy said.
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 Matt 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.
''There's a little bit of anticipated excitement coming in here knowing that Pence is going to be coming in at any given time,'' Lincecum said just before Pence dropped his red Phillies duffle bag into his new locker next to the pitcher. ''Here comes another guy that we have to bring excitement.''
Justin Turner's RBI double in the second was all the Mets managed off Lincecum (5-11). The former ace allowed six hits and one walk in another step toward turning around the worst season of his career. Left-hander Jeremy Affeldt tossed two scoreless innings for his second save in three chances this season.
''I'm just trying to build that consistency,'' Lincecum said. ''Just trying to gain momentum.''
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 double-play ball we should have turned over,'' Mets manager Terry Collins said. ''We had another one of those innings.''
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 Wright on the curveball that left him stunned in the batter's box.
''It's hard to throw a better pitch than he threw there,'' Bochy said.
Harvey gave up four hits, three walks and three runs - two earned - in six innings. He struck out seven, and his 18 strikeouts are the most by any Mets pitcher in his first two career starts. Four others in franchise history had struck out 13.
''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.''
A few regulars were missing on both sides.
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. ... The Giants recalled INF Brett Pill from Triple-A Fresno to replace Schierholtz on the roster. Aubrey Huff is expected to go on the DL when Pence arrives. Huff injured his right knee running to first Monday night.
Follow Antonio Gonzalez at: www.twitter.com/agonzalezAP