Jonathon Niese allowed just three hits and a run over seven innings to best Giants ace Matt Cain as the Mets escaped with a 2-1 victory in San Francisco on Wednesday night.

Niese upped his record to 8-5 while striking out five batters, against two walks.

The Mets missed several opportunities to blow the game open, loading the bases in the 7th, 8th and 9th innings without pushing a single run across.

But, the Mets' often roughed up bullpen didn't allow a runner on base in the eighth and ninth innings as Tim Byrdak, Jon Rauch and Bobby Parnell combined to shutdown the Giants offense. Parnell picked up save No.4.

New York's runs came on a Ruben Tejada homer to lead off the game against Cain, his first dinger of the year, and a Jordany Valdespin fielder's choice ground out in the second.

Cain (10-4) was charged with the two runs on seven hits over five innings.

The Mets will look to take 3 of 4 from the Giants as the series wraps up on Thursday afternoon.