The first two games ended in draws as both players played cautiously. In the third, Caruana attacked more but made a mistake, and Liem capitalized on it to make it 2-1.
They played three more draws to take the score to 3.5-2.5. Liem had a chance to win game number six, but overlooked a move for checkmate.
Liem said: "I was really stupid. I was dominating but couldn’t see the last move to end this match. That was my fault."
Caruana celebrated the narrow escape by winning round seven with a quick counterattack to equalize the score.
Liem with the white pieces dominated the eighth game and won to snatch back the lead. It was now 4.5-3.5.
During the last 25 moves, Caruana did not say anything while Liem kept commenting on the stream, despite a shortage of time.
"This round was difficult, but I got ahead one more time," he said.
Liem only needed one point from the last two games to wrap up the match, and duly won the ninth game to enter the semifinals.
Liem said "I’m shocked with this result. I was just a dark horse but Caruana was a major contender for the title.
"This match was crazy. I was lucky to escape from some losses but also unlucky to make some mistakes. This match could have gone any way. Anyway, I want to thank Caruana for this match."
Caruana has an Elo rating of 2,835, the second highest in the world after Norwegian Magnus Carlsen (2,863). He was the last player to challenge Carlsen for the world title in 2018, but he was unsuccessful.
Liem, with current rating of 2,709, will play another American-Filipino, Wesley So, in the semifinals on Sunday.
Previously on Tuesday, Liem beat the current world champion, Azerbaijani grandmaster, Teimour Radjabov in Banter Series.
The tournament offers a top prize of $14,000. The two finalists will qualify for the Magnus Carlsen Chess Tour, which has prize money of $140,000.