I was told that public SMS content provider API android.provider.Telephony was taken off SDK since 1.0. It's too bad we can't just reuse it. Fortunately, Android is an open-source platform and we can look into source code to see how messages are inserted in conversation threads.
The SMS/MMS in Android are stored in SQLite database and we can use SQLite database browser to see if any thing goes wrong. Two database tables need our attention, sms and threads. If the thread_id of an SMS record has a value less than 1, it will not be grouped in the conversation.
You can take a look at android.provider.Telephony.java to understand what I say.
(static class Sent and Threads)