Raonic came agonisingly close to a golden summer on grass last year when he reached the Queen's and Wimbledon finals, only to lose to Andy Murray on both occasions.
But the Canadian's hopes of warming up for Wimbledon with another strong showing at Queen's were wrecked by Kokkinakis's stunning 7-6 (7/5), 7-6 (10/8) triumph on a baking hot afternoon in west London.
Kokkinakis needed a wild card from the tournament organisers to make the Queen's main draw after his ranking plunged to 698 following an abdominal strain that sidelined him for 18 weeks.
Finally fit again, the 21-year-old secured his first Tour level match win for 21 months at 's-Hertogenbosch last week, but even so he surely wouldn't have expected to clinch the best win of his promising career just days later.
"You don't want to know about the extensive list of injures I've had. That was 22 months out of the game," Kokkinakis said.
"I can't wait to play in the next round."
Kokkinakis faces Nicolas Mahut or Daniil Medvedev in the last 16.
Raonic only reached the last 16 at the recent French Open, but clay doesn't suit his big-serving game as well as the manicured lawns of London.
Having recently hired former Grand Slam doubles champion Mark Knowles as his coach, Raonic was looking to make a statement of intent at Queen's.
Instead, it was Kokkinakis who announced his own credentials as a future grass-court force in memorable fashion.
"I was just a little too passive. I was letting him dictate too much," Raonic said.
"Obviously the disappointment is high right now, but whatever the result was this week, I don't think that's really going to change my chances at Wimbledon."
Showing no signs of being intimidated by Raonic's power game, Kokkinakis matched him blow for blow in the first set and held his nerve to win the tie-break.
Kokkinakis's close friend Nick Kyrgios was cheering his compatriot on from courtside 24 hours after being forced to withdraw from the tournament due to injury.
Kyrgios said he would spend his time in a local Wimbledon pub while he is out of action and Kokkinakis could be forgiven for joining him for a celebratory drink after this famous victory.
Trailing 6-3 in the second-set tie-break, he saved three set points and, on his third match point, finished off Raonic with a forehand winner.