His intent may have been twofold: To take revenge on Moira, and to put his heir in charge of Merlyn Global. We'll have to see about that.
The flaw here is, for the paternity test to stand up in court, there has to be proof that the test actually compared Thea's blood to Malcolm's. What I mean, it's not like Malcolm and Moira went into the clinic with Thea and everyone showed their ID.
problem with your theory about an heir to take over Merlyn Global was he already had one (well until the undertaking brought the Glades crashing down).
I don't see the problem. Malcolm brought the information about Thea forward after Tommy died. So after his intended heir died, he releases information about the second heir. What is the problem? It's actually quite logical.