Williams struggled with her movement at first but played some fine shots in a 6-2 3-6 (10-5) defeat.
Former world number one Novak Djokovic, who is all set to make a return in Abu Dhabi this week, has said that his six-month injury-layoff from tennis had taught him not to take things for granted in his career.
Thiem had a phenomenal clay-court season in 2017, where he stood out as the main rival against a dominant Rafael Nadal.
Unexpectedly, a shocking news emerged after it was announced that Serena would be participating in the exhibition match in Abu Dhabi, looking to gauge her level before entering the opening Major of the year.
"Motherhood is phenomenal. I was a little anxious out there", Williams said on the court after the match, according to the WTA.
"But it's really good".
"I think I lost all three-set matches (after that) besides the match in London, so that was not very good for my confidence - I need confidence to play good tennis".
Though Djokovic was expected to make a return in 2018, he has chose to start his season early at the Mubadala World Tennis Championship, beginning in Abu Dhabi tomorrow.
"I'm excited. It's good to be back on court, this is such a good time for me", Williams, 36, told Eurosport.
Meanwhile, Ostapenko sounded delighted in her official statement, mentioning, "I am thrilled to be playing in Abu Dhabi at the Mubadala World Tennis Championship".
"I am really honoured to play Serena in her first match after coming back and I think it is such a great opportunity for me". He posted a photo with a boy from the audience, who snuck down to take a selfie.
"I want to get back to playing tennis, I want to be fit and healthy and that is what is driving me just now... Keep cheering for my wife".
This was Williams first outing since winning the Australian Open while eight weeks pregnant in January 2017 (a fact that will always be mind-blowing). Williams and Alexis Ohanian were married in November. That tournament is set for January 15 through January 28 at Melbourne Park.