|Defending champion Andy Murray moved into the quarter-finals with victory over Stanislas Wawrinka [GALLO/GETTY]
Top seed Rafael Nadal was sent crashing out of the Shanghai Masters on a dramatic day of action Thursday but defending champion Andy Murray survived a testing encounter to reach the quarter-finals.
World number two Nadal lost 6-7 (5/7), 3-6 to Germany's Florian Mayer, edged out in a first set tiebreak and broken twice in the second set, stunning the crowd at the Qi Zhong stadium.
Mayer made the crucial breakthrough in the seventh game of the second set to lead 4-3 and the Spaniard could not respond, broken again in the final game with the 15th seed taking his first match point.
Earlier, second seed Murray, on a red-hot run of form of 21 wins from 22 matches coming into the clash against the Swiss 13th seed Stanislas Wawrinka, won 6-4, 3-6, 6-3 under the roof.
The British player looked set for a straightforward victory after taking the first set but cut a frustrated figure as he conceded a break of serve in the second set as Wawrinka levelled the match with an ace.
Murray raced into a 5-0 lead in the decider as Wawrinka was warned by the umpire after smashing his racket, but despite a late wobble he closed out the match.
"I got myself pumped up right at the beginning of the third set. I think it was important," said Murray.
"Stan was playing very well. I was trying to control the ball.
"Especially in the middle of the second set, I was really struggling. I really had to make sure I got my feet moving."
"It was a good win because Stan played very well in the second and third sets," he said.
Ferrer into ATP Finals
Earlier, Spain's Ferrer edged into the last eight when he beat injured Juan Carlos Ferrero.
Third seed Ferrer won the all-Spanish tie 1-6, 7-5, 6-2 after a major fright in the 10th game of the second set, when he was forced to save three match points on his own serve.
The win for Ferrer means he becomes the fifth player to qualify for the season-ending ATP World Tour Finals, featuring the world's top eight singles players over the year.
Speaking about qualifying for the season-ending showpiece, Ferrer said: "I think this season I have played really good tennis. I am very consistent. Maybe it is my best year of my career. I think so."
Injury-cursed Ferrero had strapping applied to his right ankle midway through the second set after a nasty tumble and although he recovered to force the match points, his challenge faded in the third set.
American 10th seed Andy Roddick reached the last eight after an impressive 6-3, 6-4 win over Nicolas Almagro, seeded seven, of Spain.
Ukrainian 12th seed Alexandr Dolgopolov also reached the quarter-finals, beating Australian teenager Bernard Tomic.
Japan's Kei Nishikori triumphed over Santiago Giraldo of Colombia and Australia's Matthew Ebden beat eighth seed Gilles Simon of France.