Updated

SAN FRANCISCO (AP) — Closer Brian Wilson found himself in a tight spot trying to preserve a win for Tim Lincecum after the San Francisco Giants failed to do so the last three times their ace pitched.

Bases loaded, two out and a full count, Kaz Matsui kept fouling off fastball after fastball until he finally flied out on the 15th pitch to end the game. Wilson could exhale, along with Lincecum, manager Bruce Bochy and the rest of the team.

Unbeaten Lincecum won for the first time in four starts, Juan Uribe hit a two-run homer in the fourth as San Francisco finally got to Astros ace Roy Oswalt, and the Giants beat Houston 2-1 on Saturday.

"I don't know if there's a tougher save ever than what he went through," Bochy said. "I just watch and hope."

Wilson saw the manager pacing and asked him afterward if he was nervous, and he walked through the postgame handshake line and razzed Lincecum.

"I said, 'Bro, why does it always have to be on your starts? Can you just give me a bigger lead, maybe?'" Wilson said. "After a while, it was kind of comical. How long an at-bat was it, 15 pitches? It felt like a half-hour. ... That was fun."

Lincecum (5-0) struck out five and walked five but outdueled Oswalt (2-5) in a rematch of the hard-throwing righties from opening day, helping the Giants improve to 5-0 against the Astros this season.

Wilson relieved Lincecum after the eighth and earned his eighth save in nine chances. But not before he loaded the bases and made it interesting as usual.

"I don't think there's anything more exciting than the bases loaded, 3-2, for 15 pitches or whatever," Lincecum said.

Houston took the lead in the first on a wild pitch, then managed little else against Lincecum. Slugger Carlos Lee was ejected in the sixth by plate umpire Bill Welke for arguing a called third strike.

Uribe's two-out drive in the fourth put the Giants ahead, and the shortstop also had a pair of singles. His fourth homer was his first in 45 at-bats.

Lincecum earned his first win since April 23 following three straight no-decisions in which the two-time reigning NL Cy Young Award winner left with the lead. He insisted he wasn't concerned.

"I don't know, get over it, not worry about it," he said. "There's no need to think about it."

The pitcher pumped his fist and yelled "Yeah!" after right fielder Nate Schierholtz made a running, diving catch on former Giant Pedro Feliz's hard liner to end the sixth.

Lincecum and the Giants won 5-2 at Houston back on April 5 to end Oswalt's three-start winning streak against San Francisco.

The 32-year-old Oswalt, who began the day with the third-lowest run support in the National League at 2.44, lost his third straight decision despite seven strikeouts and no walks in seven innings. He allowed six hits.

"I'm sure there's a major frustration, to have a guy pitch like that and continue to struggle a little bit and he's not getting rewarded for it," manager Brad Mills said.

Oswalt said in recent days he would waive the full no-trade clause in his contract if the Astros wanted to shop him to a contender — though he would like to stay put and help the Astros win.

"I've been going (through) this for three years," he said of the frustrations. "All I can do is pitch. There's nothing else I can do. We'll see what happens."

Houston (13-23) owns the worst record in the National League.

Last July 5 at AT&T Park, Oswalt allowed one run and three hits over eight innings in a 7-1 victory over the Giants.

Giants leadoff hitter Aaron Rowand singled with two outs in the fifth, ending an 0-for-18 stretch. Rowand was thrown out at home moments later trying to score on Andres Torres' double.

Astros leadoff man Michael Bourn stole bases in the first, third and eighth innings — giving him 14 this year — a day after the Giants did early defensive work focused on holding baserunners.

NOTES: The Giants are waiting to make a final decision on whether to place LF Mark DeRosa (wrist) on the DL until they know when 2B Freddy Sanchez can rejoin the team from his rehab assignment with Triple-A Fresno. ... Uribe came in 3 for 8 lifetime (.375) vs. Oswalt. ... Giants 3B Pablo Sandoval was held out of the lineup after getting hit on the left foot by a pitch from Jeff Fulchino in the eighth inning Friday night. Sandoval was available to pinch-hit and could be seen dancing in the dugout. ... Astros reliever Tim Byrdak rejoined the team after receiving an injection in his lower back Friday in Houston. He is expected to play catch in the next couple of days.

(This version CORRECTS Giants 2, Astros 1. Optional. SUBS final graf to correct Bourn's stolen base total to 14 and ADD he also had steal in the eighth.)