Medvedev struck an ace out wide to hold serve and lead 5-4.
Serving to stay in the set, Gasquet hit a crosscourt forehand volley winner to reach 30 all.
The wildcard entry Medvedev struck two crosscourt return errors to drop the game and level the set at five games all.
In the tiebreaker, Medvedev netted a down the line backhand dropshot en route to trailing 2-4.
Gasquet then struck two crosscourt backhand errors to level the tiebreaker score at 4 all.
The 26 year old Medvedev struck a crosscourt backhand long to trail 4-5 which he followed up with a down the line backhand winner to level the tiebreaker score at 5 all.
However the six feet six inches tall player then netted a crosscourt backhand to trail 5-6 and face matchpoint.
A Medvedev doublefault would end the match after one hour and 29 minutes of play.
Medvedev was playing in his first tournament following a six week injury break due to a small procedure to repair a small hernia after Miami in March.
The 35 year old Gasquet deployed a powerful one handed backhand to break serve three times for the day to advance to the quarterfinal round.