when building a system like this, what I recommend is you create a table for all the parent/main threads. Then create another table for all child/reply threads and you create a field which tell which parent id it belongs to.
Now you can have as many replies to the main thread and can hide/show them as you please.
When deleting sub-threads you can just delete the records from the child table, but when deleting the main parent thread, you have to tell the page to delete all child records with the same parent id as the actual parent record.
Hope that helps.
A