Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 5779)
+++ wp-includes/functions.php	(working copy)
@@ -354,16 +354,14 @@
 
 	wp_protect_special_option($name);
 
-	// Make sure the option doesn't already exist we can check the cache before we ask for a db query
+	// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
 	$notoptions = wp_cache_get('notoptions', 'options');
-	if ( is_array($notoptions) && isset($notoptions[$name]) ) {
-		unset($notoptions[$name]);
-		wp_cache_set('notoptions', $notoptions, 'options');
-	} elseif ( false !== get_option($name) ) {
+	if ( !is_array($notoptions) || !isset($notoptions[$name]) )
+		if ( false !== get_option($name) )
 			return;
-	}
 
 	$value = maybe_serialize($value);
+	$autoload = ( 'no' === $autoload ) ? 'no' : 'yes';
 
 	if ( 'yes' == $autoload ) {
 		$alloptions = wp_load_alloptions();
@@ -373,6 +371,13 @@
 		wp_cache_set($name, $value, 'options');
 	}
 
+	// This option exists now
+	$notoptions = wp_cache_get('notoptions', 'options'); // yes, again... we need it to be fresh
+	if ( is_array($notoptions) && isset($notoptions[$name]) ) {
+		unset($notoptions[$name]);
+		wp_cache_set('notoptions', $notoptions, 'options');
+	}
+
 	$name = $wpdb->escape($name);
 	$value = $wpdb->escape($value);
 	$description = $wpdb->escape($description);

