First of all: all email messages are required to have a Message-ID header (
If a message has no Message-ID header it's not a valid email and means
that the sending client is broken.
All replies should include an In-Reply-To header (
a References header (
IMail.References) filled with the original message's Message-ID.
In-Reply-To contains a single message id while References includes all ids in this thread.
Majority of email clients/servers do use the In-Reply-To and Reference headers.
Another way is to include a certain reference number such as "[ref:XXXXXXXXX:ref]" inside the subject and/or email body and check for that.
Downside is, clients/agents (or even people) could remove it.
In most cases I'd suggest using both techniques.