--- casetracker_mail.module.orig	2008-06-19 12:14:50.000000000 -0500
+++ casetracker_mail.module	2008-06-26 16:17:39.000000000 -0500
@@ -183,10 +183,14 @@ function casetracker_mail_nodeapi(&$node
  *   case_type: bug
  */
 function casetracker_mailhandler($node, $result, $msg_number, $header, $mailbox) {
-  $source_msg_id = $header->references; // used for comment replies. actually
-  // dependent on a few assumptions: the angle brackets are stored in the
-  // casetracker_mail table and that a reply can never be replied too. both
-  // are accurate, but it's not the most flexible of designs.
+  if ($header->references) {
+    $source_msg_id = $header->references; // used for comment replies. actually
+    // dependent on a few assumptions: the angle brackets are stored in the
+    // casetracker_mail table and that a reply can never be replied too. both
+    // are accurate, but it's not the most flexible of designs.
+  } else {
+    $source_msg_id = $header->in-reply-to;
+  }
 
   // determine the right values based on those in the email.
   $node->title     = $node->case_title ? $node->case_title : $node->title;
