Kokkinakis, 21, needed a wild card from the tournament organisers to make the Queen's main draw after his ranking plunged to 698 following a host of injuries.
After muddling his way through to a first-set tiebreak, Murray led 3-1 when the Australian double-faulted.
"I wouldn't want to place any blame there. I would have liked more matches here", Wawrinka said. "So I feel very pleased with the way I played, it's very similar to the way I was playing last week".
Kokkinakis faces Nicolas Mahut or Daniil Medvedev in the last 16.
"I'm proud of the tournament I had", Murray said two weeks ago after a five-set semifinal loss to Stan Wawrinka.
But, out-smarted by Lopez, the three-time Grand Slam champion, said: "I'm really sad to have lost".
In what will surely be a contender for understatement of the year, Thompson admitted that he "didn't expect to be winning in straight sets", and he also confirmed that it's "the biggest win of my career". I knew I was the next one in.
Murray wasn't the only favorite to go down on Tuesday.More news: US Supreme Court to re-hear immigrant detention rights case
Thompson, who has been on the Tour for less than four years and had never won a Tour-level grass-court match before Tuesday, was drafted in as a late lucky loser after Aljaz Bedene withdrew in the morning with an injured wrist.
Murray failed to contain Thompson's serve as the 23-year-old became the first player since Roger Federer in 2015 to not be broken by the man considered the best returner in the game.
After reaching the French Open semi-finals to raise hopes that he was finally back on track following a poor first half of the season, Murray will head to Wimbledon, which starts on July 3, with fresh doubts about the state of his game.
Defeat has not wrecked Murray's preparations to begin the defence of his Wimbledon title on Monday week but it has put a totally unexpected hole in them. When I have done well here, Wimbledon has tended to go pretty well, too. Novak has won Wimbledon before without playing any matches leading in and Rafa has done the same, so let's all not panic about it.
"It has happened in the past where guys haven't done well and gone on to do well at Wimbledon".
While Wawrinka's exit wasn't too much of a surprise, given Lopez's recent form and liking for grass, the early departure of third-seeded Raonic in the first match on centre court certainly was. When I got here, someone pulled out, and I got to play Andy. "Obviously it would have been a lot easier scheduling everything if I was to be here and have many more matches ahead of me".
The result is all the more shocking because Murray seemed to have found some semblance of form in Paris, where he came within a set of the French Open final.
"I'm trying to get myself going week by week".