Index: nodereference.module
===================================================================
--- nodereference.module	(revision 13)
+++ nodereference.module	(working copy)
@@ -124,6 +124,13 @@
             '#required' => FALSE,
             '#description' => t('Provide a comma separated list of arguments to pass to the view.'),
           );
+          $form['advanced']['advanced_view_valid'] = array(
+            '#type' => 'checkbox',
+            '#title' => t('Allow previous valid nodes'),
+            '#default_value' => isset($field['advanced_view_valid']) ? $field['advanced_view_valid'] : 0,
+            '#required' => FALSE,
+            '#description' => t('Allow for invalid nodes if previously valid (used when a advanced view is used that can invalidate previously invalid nodes, otherwise preventing editing of node).'),
+          );
         }
         else {
           $form['advanced']['no_view_help'] = array(
@@ -139,6 +146,7 @@
       if (module_exists('views')) {
         $settings[] = 'advanced_view';
         $settings[] = 'advanced_view_args';
+         $settings[] = 'advanced_view_valid';
       }
       return $settings;
 
@@ -218,13 +226,27 @@
         }
       }
       // Prevent performance hog if there are no ids to check.
-      if ($ids) {
+      $valid = array();
+      if ($field['advanced_view_valid'] && $field['advanced_view']) {
+        $field_name = $field['field_name'];
+        $previous_values = $node->$field_name;
+        if (is_array($previous_values))
+            foreach ($previous_values as $delta => $val)
+                     $previous_nids[$delta] = $val['nid'];
+        if ($previous_nids ) {
+           foreach($ids as $nid) {
+                   $key=array_search($nid, $previous_nids);
+                   if ($key !== false) $valid[$key] = $nid;
+               }
+        }
+      }
+      if ($ids && count($valid) != count($ids)) {
         $refs = _nodereference_potential_references($field, '', NULL, $ids);
         foreach ($items as $delta => $item) {
           if (is_array($item)) {
             $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
             if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
-            if (!empty($item['nid']) && !isset($refs[$item['nid']])) {
+            if (!empty($item['nid']) && $valid[$delta] != $item['nid'] && !isset($refs[$item['nid']])) {
               form_set_error($error_element, t("%name: this post can't be referenced.", array('%name' => t($field['widget']['label']))));
             }
           }
