NEW YORK (AP) - San Francisco Giants manager Bruce Bochy took it upon himself to get his slumping hitters ready for R.A. Dickey.
Bochy threw a steady diet of knuckleballs during batting practice, and it paid off. Aubrey Huff ended an 0-for-20 slide with a leadoff homer in the 10th inning and San Francisco snapped out of its offensive slumber, beating the New York Mets 7-6 on Tuesday night.
"It's nice to see something like that. He threw a couple rounds, pretty good knuckleballs," said Mike Fontenot, who batted third in a juggled lineup. "I'm not going to say it had as much movement as Dickey's did, but it kind of got us in the frame of mind. It's not bad. I could tell he's been working on it a little bit."
Nate Schierholtz homered for the Giants, who had lost eight of 11. The defending World Series champions, shut out three times in their previous six games, entered with the second-worst offense in the National League.
"It was big for us to put up some runs," Schierholtz said. "Just a matter of time. ... We're not worried. You go through ups and downs as a team. We had plenty of them last year. Better early than late."
Javier Lopez (1-0) and Francisco Rodriguez escaped dicey jams in the ninth before Huff sent a 2-0 pitch from Taylor Buchholz (1-1) off the facing of the right-field overhang for his third home run.
Before that, Huff was in a 3-for-37 rut with one RBI during that stretch. He entered the game batting .190.
"You get in some of these slumps like this and you just try and stay positive as much as you can, especially in games like that," Huff said. "Hopefully that gets me going."
Brian Wilson got three outs to earn his ninth save in 10 chances.
Carlos Beltran hit a three-run homer and Ike Davis a two-run shot for the Mets off Ryan Vogelsong, a winner last week at Pittsburgh in his first major league start since 2004.
The 33-year-old journeyman was a brief respite for the Mets while facing Roy Halladay, Cliff Lee and Tim Lincecum in a four-game stretch.
"When you've got one of your better pitchers on the mound and you've scored six, you've got to win those games," Mets manager Terry Collins said.
New York had the bases loaded in the bottom of the ninth, but Josh Thole grounded into a 1-2-3 double play against Lopez to end the inning.
"He's like Tom Brady out there," said Huff, praising Lopez's poise. "I think he sparked us right there, to be honest with you. The way this road trip has been, we needed that."
The Giants entered ranked 15th out of 16 NL teams in runs (99) and on-base percentage (.295). Only the San Diego Padres were worse in those categories.
Before arriving in New York, they were shut out twice while losing three of four in Washington. San Francisco totaled four runs during the entire series and had scored 23 in its last 11 games.
Bochy said the offense was "awful right now," so he tried to do something about it. Second baseman Freddy Sanchez and left fielder Pat Burrell were left out of a lineup that had the diminutive Fontenot batting third. The team held a longer-than-usual hitters' meeting before the game.
Apparently, it helped. San Francisco scored four times in the third to take a 4-3 lead, getting RBI singles from Vogelsong and Aaron Rowand before Fontenot's two-run single capped the rally.
The Giants were 3 for 42 with runners in scoring position during the first seven games of their road trip before getting three hits in those situations in the third inning Tuesday.
Schierholtz's second homer of the season put San Francisco up 6-5 in the sixth, but Jose Reyes tied it in the bottom half with a broken-bat RBI single over a drawn-in infield.
Reyes drew three walks, one intentional, after coming into the game with eight this season. He finished 3 for 3 with a stolen base.
"He had an outstanding game tonight. He gave us every chance," Collins said.
Playing their first home game since President Barack Obama announced Sunday night that terrorist leader Osama bin Laden was killed by U.S. forces in Pakistan, the Mets donated 4,000 tickets to military members and their families.
New York wore special stars-and-stripes caps, and five members of the armed services threw out ceremonial first pitches, receiving a warm hand from the crowd of 32,288. Marine Corps veteran Sgt. Elizabeth Quinones sang "God Bless America" during the seventh-inning stretch, prompting brief chants of "U-S-A! U-S-A!"
Before the game, Collins said he thought all the servicemen in the stands would give his team "a lot of energy."
"I think there will be a lot of emotions tonight," he said.
But there were several "Let's Go Giants!" chants in the late innings.
NOTES: Rowand came out in the ninth with back spasms and wasn't sure if he'd be able to play Wednesday night. ... It was Beltran's first home run from the left side this season.