I wouldn't do it via an sql query, because this wouldn't rebuild the forum- & user post count and the search index
So you would still find the threads/posts via search, and then you'll get an error
if it's not possible in xf, you would need a add-on for this ( i'll check my add-on repository, i think i've coded this already)
and what's with the thread associated (add-on ) data? (I know, many don't use add-ons, so it could be ok for them, but for everybody else, i recommend to NEVER delete something manual !
you'll have too many unnecessary add-on data in the database^^
But without an add-on, there is no other option in some cases.
Usually if I reply and say no, the follow up question then asks whether it can be done directly on the database.
So now I just give both answers in the same post.