First, I would highly recommend against allowing HTML to be posted, unless you are the only one allowed to post in the forum where you have it allowed.
I would move the CSS to your additional.css template, with the appropriate id/class selectors so that it affects table elements in your posts/post previews only.
I think the way I would go about it would be to create custom BBCodes to construct custom tables.
By the way, I tested your code on my local dev site, and while it was a mess, the HTML was not converted to BBCodes...I have no idea how that's happening unless you have custom code doing that.