Spain's Nicolas Almagro blew three chances to serve out his match against compatriot David Ferrer, who pounced on the opportunity to seal an unlikely Australian Open semifinal berth.
Almagro had never beaten the world No5 and Heineken Open winner in 12 meetings but looked a near certainty to make it through to the last four at a Grand Slam for the first time after winning the opening two sets and then serving for the match.
Instead Ferrer clawed his way back to triumph 4-6, 4-6, 7-5, 7-6 (7-4), 6-2.
Almagro injured his groin midway through the tiebreak and never troubled Ferrer in the deciding set.
In a stunning showing in the opening two sets, the 27-year-old world No11 dominated Ferrer with his huge serve and devastating one-handed backhand.
However, just when it appeared Almagro would wrap it up in straight sets, serving for the match up 5-4, Ferrer showed his fighting qualities to break back with a belting forehand down the line.
He then held his serve and broke Almagro again as he won four straight games to wrap up the third set.
The pair traded breaks early in the fourth before Almagro had the chance to serve for the match but crumbled again.
Ferrer gave him yet another chance to wrap up the match but he was unable to take it and the contest went to a tiebreak, where Almagro injured his groin stretching for a drive volley.
China's Li Na ended the winning streak of Poland's Agnieszka Radwanska to reach the semifinals.
Li, a finalist in 2011, took one hour 42 minutes to defeat the Pole 7-5, 6-3.
Radwanska went into the clash on the back of a run of 13 consecutive match wins, taking out the ASB Classic in Auckland and a Sydney tournament.
The 66-minute first set was littered with seven service breaks and finally sealed by Li despite her messy list of 29 unforced errors.
Li raced to a 5-2 lead in the second set with two service breaks in a row before serving out the match.
Radwanska and Li had met nine times previously with the Chinese player leading their head-to-head clashes 5-4.
The 30-year-old Chinese star credited coach Carlos Rodriguez, whom she took on last August, with helping her put in the work needed to still challenge the top players with a tough training schedule.
Radwanska said she felt she had been too slow on the court but Li had played solidly throughout the match.
4-David Ferrer (ESP) bt 10-Nicolas Almagro (ESP) 4-6 4-6 7-5 7-6(4) 6-2.
6-Li Na (CHN) bt 4-Agnieszka Radwanska (POL) 7-5 6-3.