Thiem, playing his first tournament since reaching the Australian Open final, was pushed by Jaume Munar before winning 6-7 (5-7) 6-3 6-4 on the clay in Brazil.
The No.1 seed from Australia, who won the ATP 500 event in 2017, needed two hours, 41 minutes to advance, having also dropped a set in his opener.
Thiem will face Gianluca Mager in the quarter-finals after the Italian qualifier's 6-3 7-6 (7-5) victory over Joao Domingues.
Borna Coric moved into the last eight courtesy of a 6-3 1-6 7-6 (7-5) win against wildcard Thiago Seyboth Wild.
The No.5 seed will meet Lorenzo Sonego, who upset No.2 seed Dusan Lajovic 7-6 (7-5) 7-6 (7-5).
At the Delray Beach Open, Raonic, the 2017 runner-up, served 11 aces in a 7-5 6-3 win over Cedrik-Marcel Stebe that sent him into the quarter-finals.
Steve Johnson awaits the Canadian after overcoming 2017 champion Jack Sock 6-4 5-7 6-1.
Frances Tiafoe, the 2018 winner, and Ugo Humbert set up a last-eight meeting with straight-sets victories over Tommy Paul and Miomir Kecmanovic respectively.