diff --git a/privatemsg.api.php b/privatemsg.api.php
index 0922740..fd7c095 100644
--- a/privatemsg.api.php
+++ b/privatemsg.api.php
@@ -539,6 +539,32 @@ function hook_privatemsg_message_status_changed($pmid, $status, $account) {
 }
 
 /**
+ * Allows response to a deleted change.
+ *
+ * Modules implementing this hook should be aware that messages are only
+ * marked as deleted and not removed from the database. They will only
+ * eventually be deleted by the flushing.
+ *
+ * Therefore, modules should not delete data in this hook but in
+ * hook_privatemsg_message_flush().
+ *
+ * @param $mid
+ *   Message id.
+ * @param $deleted
+ *   TRUE when the message was marked as deleted, FALSE when marked as not
+ *   deleted.
+ * @param $account
+ *   User object, if NULL then the message was marked as deleted for all users.
+ *
+ * @see privatemsg_message_change_delete()
+ * @see privatemsg_thread_change_delete()
+ *
+ */
+function hook_privatemsg_message_status_changed($mid, $deleted, $account) {
+
+}
+
+/**
  * @}
  */
 
diff --git a/privatemsg.module b/privatemsg.module
index 3b09803..11c2183 100644
--- a/privatemsg.module
+++ b/privatemsg.module
@@ -1479,6 +1479,9 @@ function privatemsg_message_change_delete($pmid, $delete, $account = NULL) {
     // Mark deleted for all users.
     db_query('UPDATE {pm_index} SET deleted = %d WHERE mid = %d', $delete_value, $pmid);
   }
+
+  // Allow modules to respond to the deleted changes.
+  module_invoke_all('privatemsg_message_status_delete', $pmid, $delete, $account);
 }
 
 /**
@@ -2191,16 +2194,26 @@ function privatemsg_thread_change_delete($threads, $delete, $account = NULL) {
     $account = drupal_clone($user);
   }
 
-  // Merge status and uid with the threads list. array_merge() will not overwrite/ignore thread_id 1.
-  $params = array_merge(array($delete, $account->uid), $threads);
+  // Record which messages will be deleted.
+  $changed = array();
+  $cond = $delete ? '=' : '>';
+  $result = db_query("SELECT mid FROM {pm_index} WHERE deleted $cond 0 AND recipient = %d and type IN ('user', 'hidden') AND thread_id IN (" . db_placeholders($threads) . ')', array_merge(array($account->uid), $threads));
+  while($row = db_fetch_object($result)) {
+    $changed[] = $row->mid;
+  }
 
-  // Load all messages of those threads including the deleted.
-  $query = _privatemsg_assemble_query('messages', $threads, $account, TRUE);
-  $result = db_query($query['query']);
+  // Merge status and uid with the threads list. array_merge() will not overwrite/ignore thread_id 1.
+  $delete_value = 0;
+  if ($delete == TRUE) {
+    $delete_value = time();
+  }
+  $params = array_merge(array($delete_value, $account->uid), $threads);
+    // Update the status of the threads.
+  db_query("UPDATE {pm_index} SET deleted = %d WHERE recipient = %d and type IN ('user', 'hidden') AND thread_id IN (" . db_placeholders($threads) . ')', $params);
 
-  // Delete each message. We need to do that to trigger the delete hook.
-  while ($row = db_fetch_array($result)) {
-    privatemsg_message_change_delete($row['mid'], $delete, $account);
+  // Allow modules to respond to the deleted changes.
+  foreach ($changed as $mid) {
+    module_invoke_all('privatemsg_message_status_delete', $mid, $delete, $account);
   }
 
   if ($delete) {
