Vekic, who struggled for form and fitness after the operation, burst into tears after beating the 123rd-ranked qualifier to book a clash with seventh seed Jasmine Paolini, who later beat 19th seed Emma Navarro, for a place in Saturday's final.
"Those couple of years were tough," said Vekic, reflecting on the period after her surgery.
"Now, reaching my best result ever at a Grand Slam, I'm really proud of myself, of the work that I've done, of the work that my team has done.
"I'm thankful to them for believing in me when I didn't."
The victory also meant unseeded Vekic became only the second woman from her country to move into the All England Club semis, matching the feat of Mirjana Lucic in 1999.
It was not entirely smooth sailing.
Sun saved three breakpoints under the Court One roof and broke for a crucial 6-5 advantage before digging herself out of a hole again to seize the opening set on serve with the most delicate of drop shots.
"It was a really tough match. She played unbelievable. She pushed me to my limits," Vekic said on court.
"I felt like I was dying out there the first two sets. My chance came in the end."
Left-hander Sun surrendered her serve in the eighth game of the second set before Vekic made a flurry of double faults while serving for the set, only to regain composure and draw level in the match with another break.
Vekic produced a deft drop shot of her own on set point as Sun appeared a shadow of her former self as the match wore on.
The clash turned on its head when world number 37 Vekic broke in the third set after a double fault from Sun's racket, and the former Australian Open and U.S. Open quarter-finalist quickly pulled away for a 5-0 lead.
She duly settled the contest on serve to dash the cramping Sun's hopes of becoming the first female qualifier to make the Wimbledon semi-finals since American Alexandra Stevenson 25 years ago.
![Key match stats Key match stats](https://livesport-ott-images.ssl.cdn.cra.cz/r900xfq60/f5f1b031-5cab-436b-89f7-eea5d7548be6.jpg)
The result was the perfect reward for Vekic's persistence.
Only Barbora Strycova (53), Anastasia Pavlyuchenkova (52), Elena Likhovtseva (46) and Roberta Vinci (44) have needed more Grand Slam appearances to make a maiden semi-final since the sport turned professional in 1968.
"It's not easy at times. I had to really dig deep inside and push myself," Vekic said.
"If I didn't have the team of people around me, I don't know how I would find the strength in me."