Ferrer, the top-ranked Spaniard in New York in the absence of the injured Rafael Nadal, saw off 13th-seeded Frenchman Gasquet in two hours and 54 minutes of playing time.
But two lengthy rain delays meant the tie, which started shortly after 1:15 p.m. local time, did not finish until just before 8:30 p.m.
Fourth seed Ferrer will face either Serb eighth seed Janko Tipsarevic or Philipp Kohlschreiber, the German 19th seed, for a place in the semi-finals.
“The rain made it very difficult,” said Ferrer. “But the fans have been great and I wanted to win it for them.”
The 30-year-old Ferrer took a 7-1 career lead over Gasquet into the last-16 tie, having also triumphed at the same stage at the Australian Open this year.
He made that 8-1 on a fifth match point on a damp and humid Louis Armstrong Stadium. Ferrer was a semi-finalist in New York in 2007.
Photos: Kareena Kapoor Khan and Aamir Khan at Mumbai airport
Photos: SRK, wife Gauri, Aishwarya Rai, Shweta Bachchan at Vogue Awards
Photos: Harbhajan Singh-Geeta Basra's TV outing with daughter Hinaya
Photos: Malaika Arora flaunts ripped jeans like a boss!
Photos: Vaani Kapoor, Kriti Sanon, Dia Mirza sizzle on the ramp