diff --git a/modules/dashboard/dashboard.install b/modules/dashboard/dashboard.install
index 5021826..a933127 100644
--- a/modules/dashboard/dashboard.install
+++ b/modules/dashboard/dashboard.install
@@ -76,3 +76,74 @@ function dashboard_enable() {
 function dashboard_uninstall() {
   variable_del('dashboard_stashed_blocks');
 }
+
+/**
+ * @addtogroup updates-7.x-extra
+ * @{
+ */
+
+/**
+ * Remove blocks from dashboard that do not exist.
+ */
+function dashboard_update_7000() {
+  // If we are enabled, get list of blocks from the database.
+  if (module_exists('dashboard')) {
+    $result = db_select('block', 'b')
+      ->fields('b', array('module', 'delta'))
+      ->condition('b.region', dashboard_regions(), 'IN')
+      ->execute();
+
+    foreach ($result as $block) {
+      $stashed_blocks[] = array(
+        'module' => $block->module,
+        'delta' => $block->delta,
+      );
+    }
+  }
+  else {
+    // Otherwise get list of blocks from variable.
+    $stashed_blocks = variable_get('dashboard_stashed_blocks', array());
+  }
+
+  $all_blocks = array();
+  // Gather all the blocks defined by modules.
+  foreach (module_implements('block_info') as $module) {
+    $module_blocks = module_invoke($module, 'block_info');
+    foreach ($module_blocks as $delta => $block) {
+      $all_blocks[$module][$delta] = $block;
+    }
+  }
+
+  $delete_blocks = array();
+  // Go through the blocks on the dashboard and make a list of those to delete.
+  foreach ($stashed_blocks as $block) {
+    // If the block does not exist in all blocks, it needs to be removed.
+    if (!isset($all_blocks[$block['module']][$block['delta']])) {
+      $delete_blocks[] = $block;
+    }
+  }
+
+  if (module_exists('dashboard')) {
+    if ($delete_blocks) {
+      $or = db_or();
+      foreach ($delete_blocks as $block) {
+        $or->condition(db_and()
+          ->condition('module', $block['module'])
+          ->condition('delta', $block['delta']));
+      }
+      db_delete('block')
+        ->condition($or)
+        ->execute();
+    }
+  }
+  else {
+    foreach ($delete_blocks as $block) {
+      unset($stashed_blocks[$block['module']][$block['delta']]);
+    }
+    variable_set('dashboard_stashed_blocks', $stashed_blocks);
+  }
+}
+
+/**
+ * @} End of "addtogroup updates-7.x-extra".
+ */
diff --git a/modules/dashboard/dashboard.js b/modules/dashboard/dashboard.js
index 6a55e6c..d44879b 100644
--- a/modules/dashboard/dashboard.js
+++ b/modules/dashboard/dashboard.js
@@ -212,7 +212,9 @@ Drupal.behaviors.dashboard = {
       var region = $(this).parent().attr('id').replace(/-/g, '_');
       var blocks = $(this).sortable('toArray');
       $.each(blocks, function() {
-        order.push(region + '[]=' + this);
+        var block_module = $('#' + this).attr('class').match(/\bmodule-(\S+)\b/)[1];
+        var block_delta = $('#' + this).attr('class').match(/\bdelta-(\S+)\b/)[1];
+        order.push(region + '[]=' + block_module + ':' + block_delta);
       });
     });
     order = order.join('&');
diff --git a/modules/dashboard/dashboard.module b/modules/dashboard/dashboard.module
index 4cf654f..3c7d23d 100644
--- a/modules/dashboard/dashboard.module
+++ b/modules/dashboard/dashboard.module
@@ -424,6 +424,19 @@ function template_preprocess_dashboard_admin_display_form(&$variables) {
 }
 
 /**
+ * Implements template_preprocess_block().
+ */
+function dashboard_preprocess_block(&$variables) {
+  if (dashboard_is_visible()) {
+    // Since the transformations performed by drupal_html_id() are irreversible,
+    // rendering it impossible to use the CSS id to identify individual blocks,
+    // we add two classes to aid in identification.
+    $variables['classes_array'][] = 'module-' . $variables['block']->module;
+    $variables['classes_array'][] = 'delta-' . $variables['block']->delta;
+  }
+}
+
+/**
  * Determines if the dashboard should be displayed on the current page.
  *
  * This function checks if the user is currently viewing the dashboard and has
@@ -552,7 +565,7 @@ function dashboard_update() {
       }
       foreach ($blocks as $weight => $block_string) {
         // Parse the query string to determine the block's module and delta.
-        preg_match('/block-([^-]+)-(.+)/', $block_string, $matches);
+        preg_match('/([^:]+):(.+)/', $block_string, $matches);
         $block = new stdClass();
         $block->module = $matches[1];
         $block->delta = $matches[2];
