Dickey (5-7) recovered from two consecutive poor starts to turn in his best game since being acquired by Toronto from the New York Mets and signed to a two-year, $25 million contract in December.
The reigning Cy Young Award winner baffled the Giants on two hits and two walks while striking out five as the Blue Jays split a two-game interleague series.
But as San Francisco's Barry Zito delivered the pitch, Dickey straightened up and poked a grounder past Sandoval that rolled down the left-field line for a 1-0 lead.
He later scored on Jose Bautista's hit and Mark De Rosa capped the outburst with a two-run single.
Zito (4-4) was charged with the loss, surrendering four runs on seven hits over six full innings.
Moore to attend retreat in to avoid Kutcher's wedding
Yosemite climber falls 30 feet, suffers major injuries