The Australian world number 22 eventually came through 6-1, 3-6, 6-4, but only after an almighty struggle with her serve.
The Australian world number 22 eventually came through 6-1, 3-6, 6-4, but only after an almighty struggle with her serve, a string of unforced errors and her own state of mind.
She will play American Jennifer Brady on Saturday for a place in Sunday's final.
There was no sign of the drama to come when the 23-year-old raced through the first set 6-1 against her fellow Australian ranked 155.
But the Russian-born seventh seed grew increasingly petulant in a second set where she committed 20 unforced errors.
She took out her frustration on everyone including her father and coach Alexei Gavrilov at courtside, the crowd, the line judges and even a ball boy.
"I lost my focus," admitted the world number 22. "I said something silly to my dad. And I was just angry with myself."
And when, on losing the set, she threw her racquet at her chair it brought a chorus of boos from the normally respectful centre court crowd in Victoria Park.
The third set was littered with double faults and unforced errors from both players.
"I could have finished it a bit earlier in the third set. I did not play great tennis at all," confessed Gavrilova in an honest assessment. "Sometimes you have those days."
In the end Gavrilova sneaked over the line despite serving 16 double faults and having her serve broken five times.
"I will definitely work on my serve tomorrow morning," said Gavrilova with a wry smile.
Her opponent on Saturday, Brady, reached a WTA Tour semi-final for the first time in her career with a 7-5, 6-4 win over fellow American Nicole Gibbs earlier on Friday.
"It will be a tough match. Jenny's playing well. I hope I can serve better," said Gavrilova.
China's Wang Qiang later recorded a remarkable straight sets victory 7-5, 6-2 against Sam Stosur after being close to retiring early in the match.
Wang, China's number three who has been battling a flu-type virus all week, felt so sick a doctor was called onto court at the changeover after just three games.
A long medical timeout ensued and Wang said after that she had felt dizzy and had trouble with her vision.
"I was close to retiring. I felt really sick and I couldn't see the ball," said Wang, the world number 48. "But my coach pushed me along hard."
Asked by AFP if she was glad he had, because of her victory, Wang replied: "No. Not really. But there's nothing I can do. I was surprised I won. I still feel sick now."
Wang, who had been lifted by vociferous support in the southern Chinese city, went straight off to bed in the hope of recovering before facing sixth seed Anastasia Pavlyuchenkova in the semi-finals on Saturday.
The world number 21 cruised to a 6-3, 6-3 win over Japan's Naomi Osaka, conqueror of Venus Williams in the previous round.
The teenage Osaka, ranked 64, had no answer to the power of the Russian world number 21 who took just an hour and 21 minutes to secure her place in the last four.