diff --git a/mollom.module b/mollom.module
index 8bc968e..9d82b27 100644
--- a/mollom.module
+++ b/mollom.module
@@ -658,7 +658,18 @@ function mollom_form_alter(&$form, &$form_state, $form_id) {
       // Append a submit handler to store Mollom session data. Requires that
       // the primary submit handler has run already, so a potential 'post_id'
       // mapping can be retrieved from $form_state['values'].
-      $form['#submit'][] = 'mollom_form_submit';
+      // @todo Core: node_form_submit() uses a button-level submit handler,
+      //   which invokes form-level submit handlers before the node/entity is
+      //   saved, so $form_state does not contain the new node ID yet. There is
+      //   no #post_submit property or form processing phase, we could rely on.
+      //   Potentially applies to other contrib entities, too.
+      if (isset($form_state['build_info']['base_form_id']) && $form_state['build_info']['base_form_id'] == 'node_form') {
+        $form_submit_key = &$form['actions']['submit'];
+      }
+      else {
+        $form_submit_key = &$form;
+      }
+      $form_submit_key['#submit'][] = 'mollom_form_submit';
 
       // Add link to privacy policy on forms protected via textual analysis,
       // if enabled.
diff --git a/tests/mollom.test b/tests/mollom.test
index ddd6e2a..ead6bc0 100644
--- a/tests/mollom.test
+++ b/tests/mollom.test
@@ -2248,37 +2248,6 @@ class MollomCommentFormTestCase extends MollomWebTestCase {
   }
 
   /**
-   * Ensure a comment can be updated by a moderator.
-   */
-  function testCommentUpdate() {
-    // Enable Mollom CAPTCHA protection for comments.
-    $this->drupalLogin($this->admin_user);
-    $this->setProtection('comment_node_article_form', MOLLOM_MODE_CAPTCHA);
-    $this->drupalLogout();
-
-    // Submit a comment.
-    $this->drupalLogin($this->web_user);
-    $this->drupalGet('comment/reply/' . $this->node->nid);
-    $session_id = $this->assertSessionIDInForm();
-    $edit = array(
-      'comment_body[und][0][value]' => 'spam',
-      'mollom[captcha]' => 'correct',
-    );
-    $this->drupalPost(NULL, $edit, t('Save'));
-    $this->assertText(t('Your comment has been posted.'));
-    $cid = db_query('SELECT cid FROM {comment} WHERE subject = :subject ORDER BY created DESC', array(':subject' => 'spam'))->fetchField();
-    $this->assertMollomData('comment', $cid, $session_id);
-
-    // Edit the comment.
-    $this->drupalLogin($this->admin_user);
-    $edit = array(
-      'comment_body[und][0][value]' => 'ham',
-    );
-    $this->drupalPost('comment/' . $cid . '/edit', $edit, t('Save'));
-    $this->assertText(t('Your comment has been posted.'));
-  }
-
-  /**
    * Return the number of comments for a node of the given node ID.  We
    * can't use comment_num_all() here, because that is statically cached
    * and therefore will not work correctly with the SimpleTest browser.
@@ -2841,6 +2810,76 @@ class MollomDataTestCase extends MollomWebTestCase {
   }
 }
 
+class MollomDataUpdateTestCase extends MollomWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Data update',
+      'description' => 'Verify that data can be updated.',
+      'group' => 'Mollom',
+    );
+  }
+
+  function setUp() {
+    parent::setUp(array('comment'));
+
+    $this->web_user = $this->drupalCreateUser(array('create article content'));
+    variable_set('comment_preview_article', DRUPAL_OPTIONAL);
+  }
+
+  /**
+   * Ensure a comment can be updated by a moderator.
+   */
+  function testCommentUpdate() {
+    // Enable Mollom CAPTCHA protection for Article nodes and comments.
+    $this->drupalLogin($this->admin_user);
+    $this->setProtection('article_node_form', MOLLOM_MODE_CAPTCHA);
+    $this->setProtection('comment_node_article_form', MOLLOM_MODE_CAPTCHA);
+    $this->drupalLogout();
+
+    // Submit a node.
+    $this->drupalLogin($this->web_user);
+    $this->drupalGet('node/add/article');
+    $session_id = $this->assertSessionIDInForm();
+    $edit = array(
+      'title' => 'spam',
+      'mollom[captcha]' => 'correct',
+    );
+    $this->drupalPost(NULL, $edit, t('Save'));
+    $nid = db_query('SELECT nid FROM {node} WHERE title = :title ORDER BY created DESC', array(':title' => 'spam'))->fetchField();
+    $this->assertUrl('node/' . $nid);
+    $this->assertMollomData('node', $nid, $session_id);
+
+    // Submit a comment.
+    $this->drupalGet('comment/reply/' . $nid);
+    $session_id = $this->assertSessionIDInForm();
+    $edit = array(
+      'comment_body[und][0][value]' => 'spam',
+      'mollom[captcha]' => 'correct',
+    );
+    $this->drupalPost(NULL, $edit, t('Save'));
+    $this->assertText(t('Your comment has been posted.'));
+    $cid = db_query('SELECT cid FROM {comment} WHERE subject = :subject ORDER BY created DESC', array(':subject' => 'spam'))->fetchField();
+    $this->assertMollomData('comment', $cid, $session_id);
+
+    // Make really sure there is another Mollom data entity using the same ID.
+    db_insert('mollom')
+      ->fields(array(
+        'entity' => 'whatever',
+        'id' => $cid,
+        'form_id' => 'whatever_form',
+      ))
+      ->execute();
+
+    // Edit the comment.
+    $this->drupalLogin($this->admin_user);
+    $edit = array(
+      'comment_body[und][0][value]' => 'ham',
+    );
+    $this->drupalPost('comment/' . $cid . '/edit', $edit, t('Save'));
+    $this->assertText(t('Your comment has been posted.'));
+  }
+}
+
 /**
  * Tests text analysis functionality.
  *
