When users delete their account, instead of deleting the content/comments they submitted, you could replace the deleted user's username with the value [deleted], replace the IP address, email address and any other PII collected about the user with the value [deleted]. That way the threads remain intact and the content is not associated with the users anymore.
Ok, I think I understand. We wouldn't replace all such usernames with [deleted], for reasons I explain here: https://news.ycombinator.com/item?id=23624019. But we randomize them, and if that's not enough, there are sometimes other things we can do.