Matt Cain's long trudge back finally has a happy ending.
The San Francisco right-hander snapped a 15-game winless streak while holding the Chicago Cubs to one run on six hits to lead the Giants to a 5-3 victory on Saturday.
After two strong -- if inconclusive earlier starts -- Giants manager Bruce Bochy saw this coming.
"I know it's been a long road for him with all he's gone through," Bochy said after the game. "More importantly, it's the way he's been throwing the ball -- the last start in Arizona and the start before that."
Cain (1-5) worked six innings to close out a winless streak that dated back to July 2015 and included eight losses.
"He really had that good tempo (tonight), good rhythm going. He really pitched a nice ballgame," Bochy added.
Chicago (29-12) has dropped four of its last six. San Francisco (26-19) has nine wins in its last 10 games.
An 0-8 losing streak by the three-time All-Star was not only the longest of his career it was the longest by a Giants pitcher since Barry Zito dropped eight straight in 2013.
Cubs starter Jon Lester (4-3) had his shortest and rockiest outing of the year, lasting just 2 2/3 innings in the middle game of a series at AT&T Park.
Cain worked six full innings while walking two and striking out five. He also contributed at the plate with a two-RBI double in the second inning while Buster Posey went 2-for-4 with two RBIs.
The Cubs rallied with single runs in the eighth and ninth but got no closer.
Javier Baez' run scoring single off Giants reliever Cory Gearrin drove in Jorge Soler to trim the margin to 5-2 with one out in the eighth.
Casilla picked up his 11th save with his ninth inning work.
Cain's second inning two-out double to deep left center drove in Brandon Crawford and Gregor Blanco for a 2-0 lead. It was Cain's first hit and RBIs of the year as he snapped an 0-for-46 streak.
Lester had already thrown 50 pitches by the time he struck out Denard Span to close the second.
Chicago got one run back on Kris Bryant's ninth homer of the season; a line-drive solo shot to center that came on a 3-2 pitch with one out in the third.
San Francisco replied with three more in the bottom of the inning, starting with Buster Posey's two-run homer to left-center that scored Joe Panik, who had led off the inning with a double. Trevor Brown later lined a two-out single to left to score Matt Duffy.
Lester walked Crawford and was pulled after just 2 2/3 innings of work, his shortest outing of the year. Lester allowed five earned runs on six hits, walked three and struck out one.
NOTES: The Giants held a moment of silence on Saturday in memory of longtime third baseman Jim Ray Hart, 74, who died Friday after a long illness. Hart batted .282 with 488 runs scored, 156 home runs and 526 RBI in 1,001 games from 1963 to 1973. ... RHP Matt Cain, Saturday's Giants starter, has not had a win since July 22, 2015, at San Diego. ... The Giants send LHP Madison Bumgarner (5-2, 2.45 ERA) against Cubs RHP Kyle Hendricks (2-3, 3.52 ERA) in Sunday's series finale. ... Cubs RF Jason Heyward will miss three-to-five days after injuring a right rib while diving to make a catch in Friday's 8-1 victory. ... Chicago activated OF Matt Sczcur off the 15-day disabled list (right hamstring strain) on Saturday and assigned RHP Neil Ramirez for assignment. ... San Francisco OFs Angel Pagan (left hamstring) and Hunter Pence (right knee soreness) were unavailable.