Setting In-Reply-To and References from the original Message-ID is what makes the reply thread correctly for the recipient too, not just in your own Gmail, since Outlook and Apple Mail ignore Gmail's threadId entirely. Keeping the subject identical apart from the Re: prefix matters for Gmail's own grouping. Storing the Message-ID next to the lead row also makes later follow ups much simpler.