"I just didn't want to hit another popup," Hill said.
Cain (6-5), who hadn't lost since May 22 and hadn't allowed more than one earned run since May 17, gave up three runs and seven hits in 7 2-3 innings.
"He was dominant all game," Hill said. "We barely got a couple of hits off him. Guys were getting jammed all day."
The praise was cold comfort for Cain, who was left kicking himself for issuing a four-pitch walk to former teammate Fred Lewis immediately before Hill's blast.
"That's why a two-out walk will hurt you so much, because these guys can beat you with the long ball," said Cain, who has allowed just five homers. "You can't give these guys extra chances. I did, and it cost us."
The homer was the 10th of the year for Hill, and Toronto's major league-leading 105th.
"They've done that all year, hit the long ball," Giants manager Bruce Bochy said. "That's what's beat us the last two games."
Cain, who walked two and struck out three, became the second Giants starter in two games to lose on a late homer. Barry Zito was beaten in Friday's 3-2 loss on an eighth-inning solo shot by Toronto third baseman Edwin Encarnacion.
Shawn Camp (2-1) pitched one inning of relief for the win and Kevin Gregg closed it out in the ninth for his 18th save in 21 chances. It's the first time this season that Gregg has saved consecutive games.
Adam Lind followed Hill's homer with a single, bringing Santiago Casilla out of the bullpen. Vernon Wells singled and Lind was replaced by pinch runner Dewayne Wise before Alex Gonzalez made it 3-0 with a broken-bat single that sent the jagged end of the bat flying into Toronto's third base dugout.
Just two batters reached scoring position through the first seven innings. San Francisco's Pablo Sandoval was stranded after a one-out double in the second and Toronto's Lyle Overbay could not advance after a two-out double in the fifth.
Making his second start of the season after undergoing elbow ligament replacement surgery, Toronto right-hander Jesse Litsch allowed three hits in seven shutout innings. He walked none and struck out three.
"Jesse just did a great job," Hill said. "We wouldn't have been there if it wasn't for what he did."
For Litsch, it was a vast improvement from his first start, June 13 at Colorado, when he allowed seven runs and nine hits in 2 1-3 innings of a 10-3 loss.
"Last time I got cutter-happy and they were sitting on it," Litsch said. "Today we worked on sinking the ball more, working on the whole repertoire instead of just a couple of pitches. From there, we rolled with it."
Edgar Renteria hit a one-out double off Camp in the eighth and, after Bengie Molina flied out, Andres Torres was intentionally walked, but Camp escaped when Freddy Sanchez grounded into a fielder's choice.
"We're just now swinging the bats right now, that's what it comes down to," Bochy said.
NOTES: The Giants are 0-5 on the road in interleague games. ... San Francisco is 4-23 when scoring fewer than four runs. ... Renteria made his first appearance since May 25 after sitting out 20 games with a strained right hamstring. ... San Francisco OF Pat Burrell was replaced by Nate Schierholtz on defense in the seventh. ... INF John McDonald rejoined the Blue Jays after being away on bereavement leave. ... Toronto DH-OF Adam Lind has been taking ground balls at 1B and could back up Overbay, manager Cito Gaston said. Jose Bautista also has experience at first.