Index: entityreference_prepopulate.module
===================================================================
--- entityreference_prepopulate.module	(revision 240)
+++ entityreference_prepopulate.module	(working copy)
@@ -128,7 +128,16 @@
       }
 
       $field = $value['field'];
-      if (entityreference_prepopulate_get_values($field, $instance) || ($id && !empty($settings['action_on_edit']))) {
+
+      // Store values in the form_state so that if the form should be rebuilt
+      // (For example, with AJAX) our default values are persisted.
+
+      $values = entityreference_prepopulate_get_values($field, $instance);
+      if ($values) {
+        $form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field['field_name']] = $values;
+      }
+
+      if ($values || ($id && !empty($settings['action_on_edit']))) {
         // New entity with prepopualte values, or an existing entity,
         // we might need to disable/ hide the group-audience field.
         if ($settings['action'] == 'disable') {
@@ -249,6 +258,24 @@
   if (isset($cache[$identifier])) {
     return $cache[$identifier];
   }
+
+  // Check to see if we cached the values in a $form_state object (and we are
+  // refreshing the form)
+  $input = isset($_GET['form_id']) ? $_GET : isset($_POST['form_id']) ? $_POST : NULL;
+  if ($input && !empty($input['form_build_id'])) {
+    $form_state = array();
+    $form = form_get_cache($input['form_build_id'], $form_state);
+    if (isset($form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name])) {
+      if ($flat_array) {
+        throw new Exception('I guess we needed to check for this after all');
+      }
+      $cache[$identifier] = $form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name];
+
+      return $cache[$identifier];
+    }
+  }
+
+
   $cache[$identifier] = FALSE;
 
   if (empty($_GET[$field_name]) || !is_string($_GET[$field_name])) {
