Jankovic needed a pain killer during the match to ease her back problem
World number one Jelena Jankovic beat Russia's Vera Dushevina 6-7 (6-8) 6-3 6-2 at the Kremlin Cup in Moscow despite struggling with a back injury.
Jankovic had to have treatment on her hip after the third game of the first set, but battled to win an epic match.
Dushevina should have won in straight sets after coming from behind in the first and breaking early in the second.
But nerves seemed to get the better of the world number 77 as Jankovic stepped up a gear to seal a quarter-final spot.
Jankovic, 23, who needed two hours and 30 minutes to record her fourth win in five matches against Dushevina, said she was tempted to retire hurt.
"Today I felt pain in my back when I practised and during the match I was feeling more and more pain," admitted the Serbian.
"It was really difficult to play as I was struggling the pain. I felt worse and worse and was even ready to quit playing when I was one set and 2-0 down.
"But after the doctor put that anaesthetic cream on my back and I took the pain killer everything changed. I did my best trying to serve well and it worked."
Both players were guilty of making a host of unforced errors as they traded breaks in the first set, which the 22-year-old wildcard eventually won after 58 minutes of play.
An upset seemed on the cards when Dushevina broke in the second set to take a 2-0 lead, but she seemed to wilt under the expectation and Jankovic broke back twice to level, and then took a commanding 4-0 lead in the third set.
Jankovic will play the unseeded Italian Flavia Pennetta, who followed up her defeat of Venus Williams with a 6-3 6-4 6-4 victory over Russia's Ekaterina Majarova.
In the other women's matches, Vera Zvonareva was in imperious form as she beat Slovakia's Daniela Hantuchova, who scored only five points on the Russian's serve, 6-1 6-0.
Zvonareva said: "I did not make unforced mistakes and was serving and returning well. But I know that one can only have one or two such easy matches in a season."
I have no illusions - I have little chance, but why not to try
Russia's Nadia Petrova progressed to the quarter-finals, where she will meet defending champion Elena Dementieva, after her opponent, Caroline Wozniacki, retired with breathing problems.
In the men's draw, top-seeded Nikolay Davydenko, who is bidding for his fourth title of the season, reached the last eight with a 6-1 6-1 win over Spain's Guillermo Garcia-Lopez.
The Russian will face seventh seed Marat Safin, who beat Julien Benneteau of France 6-4 6-0 6-2.
However, Safin was pessimistic of his chances of progressing further, saying: "I have no illusions.
"Judging from his match, he (Davydenko) plays and moves perfectly. I think I have little chance, but why not to try. I have nothing to lose."
In other second-round matches, eighth seed Janko Tipsarevic lost to Viktor Troicki 6-3 6-4 in an all-Serbian match, and Igor Kunitsyn of Russia ousted Robby Ginepri of the United States 6-4 6-3.
Germany's Mischa Zverev beat Teimuraz Gabashvili of Russia 6-2 6-2 6-1 to advance to his fourth quarter-final final of the season.