Andy Murray fought back from the brink of defeat to reach the Monte Carlo Masters quarter-finals after Benoit Paire looked set to claim the scalp of the world number two.
All-conquering world number one Novak Djokovic was sensationally beaten by Jiri Vesely in the second round on Wednesday and second seed Murray was also in danger of an early exit a day later in the glamorous principality.
Two-time grand-slam champion Murray had no answer to world number 22 Paire for much of a topsy-turvy third-round match, but hung in there and fought back to win 2-6 7-5 7-5 on Court Rainier III.
Paire pounced on Murray's second serve at every opportunity and gave the Brit the runaround with some delicate drops shots combined with a powerful backhand in a one-sided first set.
A poor service game from an out-of-sorts Murray left him trailing 3-0 in the second, but Paire lost his composure with victory in sight and the favourite took advantage to set up a decider.
Murray was up against it in the final set, saving seven of eight break points and Paire spurned another golden opportunity to seal victory when he broke at 5-4 but failed to serve out the match.
Two-time Monte Carlo Masters semi-finalist Murray had become increasingly infuriated, but drew on his experience to get the job done as Paire paid the price for 52 unforced errors.
Murray now goes on to face Milos Raonic in the quarter-finals after the Canadian defeated Damir Dzumhur.