The Astros prepared to face Dickey by taking swings in an indoor cage before the game against former major league knuckleballer Steve Sparks, now a Houston radio announcer.
It's the same strategy manager Bo Porter employed before his team faced Dickey in Toronto last July 27. In that game, Houston had five runs and seven hits off Dickey in six innings, but couldn't hold a lead and lost 12-6.
''I think it always helps,'' Porter said. ''It's not every day that you face knuckleball pitchers. We are fortunate to have Steve come out and be willing to get in the cage. I think it paid dividends today.''
Villar hit a three-run homer, Grossman had a two-run shot and Jason Castro added a solo shot as the Astros won for just the second time in eight games.
Grossman, who was hitless in 25 at-bats before taking Dickey deep, took 15 to 20 swings against Sparks and said the session was helpful.
''I have to give credit to Sparksie on that,'' Grossman said. ''Just seeing it, because you never see it.''
Villar connected on the first pitch he saw from Dickey in the seventh inning for his second of the season.
Grossman homered on a 3-0 pitch from Dickey in the fifth for his first of the season.
Castro connected off reliever Esmil Rogers to begin the eighth for his second of the season.
Dallas Keuchel pitched seven strong innings for the Astros. Keuchel (1-1) allowed one run and five hits, walked two and struck out six.
''He was outstanding,'' Porter said. ''He did a really good job of attacking the strike zone.''
Keuchel has pitched at least seven innings in all three career starts against Toronto.
''The high fastball was working for me today,'' the left-hander said. ''I wasn't really trying to mix and match, I was just trying to attack.''
After Chad Qualls worked a scoreless eighth, the Astros struggled to close it out in the ninth.
Josh Fields got two outs, but left after pinch hitter Adam Lind's two-run double. Anthony Bass came on and got Melky Cabrera to hit a grounder, but Bass' high throw to first allowed Lind to score. Maicer Izturis ended it by grounding to the mound, giving Bass his first save.
Colby Rasmus hit his first home run of the season for Toronto, a solo drive in the fifth.
Dickey (1-2) was moved up a day to face Houston on regular rest, with right-hander and fifth starter Dustin McGowan moved back to start Friday's game at Baltimore. Dickey allowed five runs and six hits in seven innings. He walked three and struck out four.
''It's a real surprise when I have a knuckleball like that and we have the outcome that we had,'' Dickey said.
On Thursday, Dickey walked two batters but didn't allow a hit through the first three innings, a streak that ended when Castro singled to begin the fourth.
Marc Krauss doubled to begin the fifth and, one out later, Grossman homered.
Rasmus cut the lead in half in the bottom of the inning, but Houston chased Dickey with a three-run seventh. Matt Dominguez hit a one-out double, Grossman walked and Villar followed with a drive to center.
Dickey allowed a career-worst 35 home runs in 34 starts last season, the second-highest total in the majors behind Oakland's A.J. Griffin (36). Dickey had not allowed a homer in his first two starts this season.
NOTES: Cabrera doubled twice, extending his hitting streak to 10 games. ... Blue Jays LH J.A. Happ (back) allowed one run and four hits in 4 2-3 innings in a rehab start at Triple-A Buffalo. Happ walked two and struck out six. ... Toronto begins a three-game series at Baltimore Friday, with McGowan (0-1) facing Orioles RH Chris Tillman (1-0). ... The Astros visit Texas on Friday, with RH Scott Feldman (2-0) facing RH Yu Darvish (1-0).