SAN FRANCISCO -- Tim Lincecum pounded the strike zone with a consistency and confidence that looked a lot like "The Freak" of old.
He only hopes this outing will carry into the next, and the one after that.
"I was able to hit my spots more often and more consistently, mechanically I felt sound, and things just kind of got better," Lincecum said. "It definitely feels good but we've still got a lot to do, a lot of work to do. I've said it before, I'm not jumping up and down right now, I'm just happy with what we did today. Tomorrow's another day for work."
Cabrera had two hits in his return to AT&T Park with Toronto for the first time since his 50-game suspension for a positive testosterone test last Aug. 15.
Lincecum (4-5) allowed Edwin Encarnacion's first-inning solo home run, then retired the next 14 Blue Jays in order.
Coming off his shortest outing of the year, 4 1/3 innings Wednesday in a 9-6 loss to Oakland, Lincecum allowed three hits and one run, struck out six, and walked one in seven impressive innings.
"That is more the Timmy that we know," manager Bruce Bochy said. "We needed it."
The Giants handed Josh Johnson (0-2) a loss in his return from the disabled list.
Torres connected for his second homer in the second, and he made a couple of nice catches in left field behind Lincecum.
The struggling right-hander looked more like his old self after losing four of five starts and five of his last six decisions -- in which he had allowed 27 earned runs in 42 1/3 innings for a 5.74 ERA.
The two-time NL Cy Young Award winner quickly regrouped after Encarancion's 17th home run and found a groove.
Cabrera apologized to the Giants and their fans during a dugout news conference before the game. He was eligible to return for the NL Championship Series, but the Giants decided in late September 2012 to keep him off the postseason roster the entire way.
Cabrera, the 2012 All-Star Game MVP, who produced a 51-hit May last year, received his World Series ring when the Giants visited Toronto last month.
He was booed -- with no sign of the "Melk Men" who used to cheer him -- by the sellout crowd of 41,981 each time he stepped into the batter's box.
"They have their reasons to do what they did. I just play my game," Cabrera said.
Cabrera went 2-for-4 with a leadoff single in the first and another base hit in the sixth but flied out with the tying run at first for the first out in the ninth.
"A guy like that, when you're getting boos, you know it's for a reason," Lincecum said. "He was a good player for us, and now he's not, so you're going to hear that here."
The Blue Jays missed a chance in the sixth. With Johnson aboard on a walk and at second following Cabrera's single, Jose Bautista hit into his second double play of the game with a liner to Pablo Sandoval at third base. Sandoval fired to second, and Marco Scutaro made the play but dropped the ball as he tumbled forward, bringing Blue Jays manager John Gibbons out to argue.
Lincecum, knocked out of his only other start against the Blue Jays after 3 2/3 innings in 2007, pumped his fist as he walked off the mound.
The pitcher's recent problems raised speculation of a possible move to the bullpen like the one last fall that was so successful for the club's run to a second World Series championship in three years.
The Blue Jays snapped a three-game losing streak with Sunday's win at San Diego but dropped their seventh in 11 overall Tuesday and ninth of 13 on the road.
Johnson looked strong in his fifth start of the year and first back since being sidelined April 22 with right triceps inflammation. He struck out six in seven innings and didn't walk a batter but dropped to 0-4 in eight career starts against the Giants.
"We missed him," Gibbons said of Johnson. "You watch a performance like that, that's what Josh Johnson is. And then Lincecum, we got on the board in the first, and he did a heck of a job of shutting us down."
Sandoval was back in the Giants' lineup after missing three games with a strain in his left foot, while center fielder and leadoff hitter Angel Pagan sat out for the ninth straight game with a strained left hamstring.
But Sandoval was replaced late in the game by Joaquin Arias. The plan had been for him to play six or seven innings, and Bochy said Sandoval was a little sore but should be available Wednesday afternoon.
Lincecum had been 0-4 in his previous five interleague outings. ... Toronto also activated OF Rajai Davis from the DL, and he grounded into an inning-ending double play as a pinch hitter in the eighth against his former team. Fellow ex-Giant Mark DeRosa had a pinch-hit single. ... The Blue Jays are 5-5 versus the NL West and fell to 1-6 all time at AT&T Park. ... An MRI on injured Toronto pitcher Ramon Ortiz's right elbow showed no significant damage after the 40-year-old righty was hurt Sunday at San Diego. ... The Giants beat the Blue Jays for just the second time in the past seven meetings after struggling with the bouncy turf in Toronto in ugly 10-6 and 11-3 losses May 14 and 15.