I know a lot of people are looking for this info, so I'll post it. This applies to any database, wherever there will be unknown quantities of data. This example is reeeally simple, but it'll show u the basics. You'll get what I'm saying.
For every table you make, give it a unique ID. Make tables for: User, Thread and Message. For the message table, also give it a thread ID column, into which you put the ID of the thread it belongs to. You can then pull out all the messages by specifying their thread ID - they don't get mixed up with the other records. Put a User ID column in the message and thread tables, too, to associate which user created the thread/post.
As you can see, the basic ideas are - don't repeat data, and only keep relevent info in one table. Let the database do the hard work by linking all your IDs together. It also makes everything run faster, as a few smaller tables perform better than one very large table.
This is a really, really basic example of what you need to do. Read up on normalisation, too, as this is what that was. :-P