The pair were scheduled to meet in the third round of the Toronto tournament but Frenchman Gasquet was forced to quit due to an abdominal strain.
Murray, who beat Australian teenager Nick Kyrgios in the second round, will now meet Jo-Wilfried Tsonga in the last eight, after the Frenchman recorded a shock 6-2, 6-2 victory over number one seed Novak Djokovic.
Djokovic came in with 11 straight wins over Tsonga but was nowhere near adding a 12th. Tsonga's serve gave Djokovic plenty of trouble. The Frenchman had only eight aces, but Djokovic continually struggled to keep his returns in play.
"No baseline, no serve, no return ... generally a bad day," Djokovic said.
Serving on match point, Tsonga clinched the win when Djokovic's return went wide. Djokovic had never looked comfortable in Toronto, his first tournament since winning Wimbledon, four days after which he married his long-time girlfriend.
On Wednesday, Djokovic needed three tough sets to outlast Gael Monfils in the second round.
Djokovic's defeat was the second big upset of the day. Third-seeded Stan Wawrinka lost 7-6 (8), 7-5 to Kevin Anderson, who will meet Grigor Dimitrov or Tommy Robredo in the quarter-finals.
World number one Serena Williams went into her third-round clash with Lucie Safarova on a high after hitting 10 aces in a dominant victory over Samantha Stosur in Montreal.
Second seed Petra Kvitova raced to a 6-3, 6-2 success over Australia's Casey Dellacqua, while Venus Williams joined her sister in the next round with a 6-3, 6-2 win over Yulia Putintseva from Kazakhstan.
But Serbian Ana Ivanovic crashed out to American qualifier Coco Vandeweghe 6-7 (7/9), 7-6 (9/7), 6-4.