San Diego, CA (SportsNetwork.com) - Justin Maxwell came on as a pinch-hitter in the 12th inning and plated the game's only with an RBI single as the San Francisco Giants escaped with a 1-0 win over the San Diego Padres in the opener of a four-game series on Thursday.

An error by shortstop Clint Barmes on a Brandon Crawford grounder and an intentional walk to Gregor Blanco put two on with two outs for Maxwell, who delivered a single to center field off Nick Vincent (0-1).

Vincent stranded runners on the corners to end the top of the 12th, but Santiago Casilla retired the side in order in the home half to pick up the save, his third of the season.

George Kontos (1-0) struck out two in 1 2/3 innings for San Francisco.

"This one could have went either way," Giants manager Bruce Bochy said. "The pitching on both sides was outstanding."

The loss overshadowed a terrific stint in long relief by Odrisamer Despaigne, who came on for Padres starter Ian Kennedy in the third inning and tossed 4 2/3 perfect innings. Kennedy left after allowing two hits and two walks in 2 1/3 innings with a left hamstring strain.

"The whole time I felt something wasn't right," Kennedy said. "I didn't feel a pop or anything, I just wasn't going to hurt my arm trying to change my mechanics."

Tim Hudson wasn't as sharp in his season debut for San Francisco, allowing five hits and five walks in 6 1/3 innings, though the Padres couldn't put any runs across.

The Padres nearly broke through in the fifth inning, when Will Middlebrooks and Yonder Alonso slapped consecutive singles to start the frame. But Jedd Gyorko grounded into a double play and Despaigne only mustered a weak grounder back to Hudson to end it.

In the sixth, Wil Myers led off with an infield single and Matt Kemp walked two batters later. Then with two down and Myers on third, Middlebrooks popped out to right.

San Diego chased Hudson from the game in the home seventh, but still couldn't plate any runs. Alonso led off with a walk and Alexi Amarista singled to put runners on the corners with one out. Jeremy Affeldt came on to pitch to pinch-hitter Yangervis Solarte, who grounded into a double play.

After the newest Padre Craig Kimbrel pitched around a leadoff triple to Angel Pagan in the top of the ninth, San Diego stranded two in the bottom half to force extras.

Game Notes

Blanco was the only player in the game with two hits ... The Padres went 6-3 at Petco Park against San Francisco last season ... San Diego went 1-for-11 with runners in scoring position and left 10 on base. The Giants went 1-for-9 with eight left.