OAKLAND, Calif. (AP) Tim Lincecum labored through a 43-pitch first inning and never lost hope.
Nine innings later, he finally had a real reason to smile.
Brandon Belt hit a tying two-run double and scored on Hector Sanchez's single during a four-run ninth inning, and the San Francisco Giants rescued Lincecum from another loss by rallying past the Bay Area rival Oakland Athletics 5-4 on Friday night. The Giants had lost the last nine games Lincecum started.
``I felt like I got mad in the right way,'' said Lincecum, who retired 18 of the final 20 batters he faced in the most tangible turnaround of his unremarkable season so far. ``I guess I channeled that madness on the field and stopped worrying about the (stuff) that happens behind me that I can't control.''
Same for the rest of San Francisco.
Ryan Cook (2-2) walked Buster Posey and Pablo Sandoval on nine pitches to open the final inning. Belt sliced a double down the left-field line just out of the reach of a diving Collin Cowgill and Sandoval blew past a stop sign by third base coach Tim Flannery to easily score the tying run from first base.
Santiago Casilla allowed Josh Reddick's 16th home run in the ninth before recording his 20th save in 21 chances. Clay Hensley (3-3) recorded one out for the victory.
``Great game. Great comeback. And it started with Timmy,'' Giants manager Bruce Bochy said. ``There are not a lot of guys who would do what he did after all he's been through this season.''
What a way for this one to finish.
Oakland starter Jarrod Parker gave up four hits and two walks, and struck out four in six-plus innings. He has allowed one run or fewer in eight of his 12 career starts.
The A's, coming off a home sweep of the Los Angeles Dodgers, were poised to win for the ninth time in 10 games until it all came tumbling down in the ninth.
Cook had allowed two runs in his first 31 2-3 innings this season. After walking the first two batters and giving up Belt's tying double, Justin Christian's single sent A's manager Bob Melvin streaming out of the dugout to replace Cook after the worst - and shortest outing - of the right-hander's season.
Joaquin Arias dropped a sacrifice bunt, and Gregor Blanco singled home Christian for San Francisco's final run. Cook was charged with all four runs.
``I just didn't have anything,'' Cook said. ``That's been my hex all year, putting guys on. It came back to bite me.''
A rare sellout crowd of 35,067 packed the aging Oakland Coliseum with green and gold sprinkled with chunks of orange and black as the summer's second edition of the Bay Bridge Series shifted to the American League ballpark.
Bochy wanted to ``shake things up'' by giving Sanchez a shot at catching Lincecum - and using Posey as the designated hitter - for only the second time this season to try to get The Freak out of his funk.
Other than the first, it worked.
Coco Crisp, Jemile Weeks and Reddick ripped three straight singles off Lincecum, and Yoenis Cespedes followed with a walk to load the bases. Smith's grounder to first base seemed to be an easy out - if not a double play - when Belt fielded the ball cleanly.
Of course, nothing has been easy for Lincecum this summer.
Belt missed the bag while throwing home trying to nab Weeks, who slid underneath Sanchez's tag. After Brandon Inge walked to put Oakland ahead 3-0, Shane Loux started warming up in San Francisco's bullpen. Lincecum regrouped to strike out the side - getting Brandon Moss, Kurt Suzuki and Cliff Pennington all swinging - and stayed in the game despite that 43-pitch inning.
Lincecum allowed three hits, four walks and struck out eight. He still extended his career-long winless streak to 10 starts.
The early mistakes finally weren't too much for the Giants to overcome.
Sanchez singled leading off the third, advanced to second on a wild pitch and scored on Blanco's one-out single to slice the A's lead to 3-1. Melky Cabrera grounded out to second with Blanco at third base to end the inning, and Belt's blast in the ninth allowed Lincecum to avoid another loss.
``Timmy said enough is enough,'' Bochy said. ``He took control, and pitched out of it.''
NOTES: Giants CF Angel Pagan sat out with an abdominal strain. Pagan will likely DH on Saturday and Sunday, Bochy said. ... Melvin said RHP Tyson Ross (2-6, 6-11 ERA), who already arrived with the team Friday, will officially be called up from Triple-A Sacramento to start Saturday in place of injured RHP Bartolo Colon (strained right oblique muscle). Ross will start opposite Giants LHP Madison Bumgarner (8-4, 2.92 ERA).
Follow Antonio Gonzalez at: www.twitter.com/agonzalezAP