If you quickly spot that you've made an error, and you think that it's too major to simply post an addendum on the same thread, post an 'answer' saying something along the lines of "Please ignore this post. I screwed up and will post again on a new thread".
Then, when you've posted your new thread, it's highly likely that a moderator will come along and remove the original one on the grounds of 'just tidying up the site'. (I've removed plenty of dud posts in that way myself).