Index: comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.658
diff -u -p -r1.658 comment.module
--- comment.module	13 Oct 2008 00:33:02 -0000	1.658
+++ comment.module	13 Oct 2008 21:01:10 -0000
@@ -719,7 +719,7 @@ function comment_save($edit) {
           // Strip the "/" from the end of the parent thread.
           $parent->thread = (string) rtrim((string) $parent->thread, '/');
           // Get the max value in *this* thread.
-          $max = db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE :thread AND nid = :nid", array(':thread' => $parent->thread .'%', ':nid' => $edit['nid']))->fetchField();
+          $max = db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE :thread AND nid = :nid", array(':thread' => $parent->thread .'.%', ':nid' => $edit['nid']))->fetchField();
 
           if ($max == '') {
             // First child of this parent.
