Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 16023)
+++ wp-includes/wp-db.php	(working copy)
@@ -1197,7 +1197,13 @@
 		$formats = $format = (array) $format;
 		$fields = array_keys( $data );
 		$formatted_fields = array();
+		$real_data = array();
 		foreach ( $fields as $field ) {
+			if ( $data[$field] === null ) {
+				$formatted_fields[] = 'NULL';
+				array_shift( $formats );
+				continue;
+			}
 			if ( !empty( $format ) )
 				$form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
 			elseif ( isset( $this->field_types[$field] ) )
@@ -1205,9 +1211,10 @@
 			else
 				$form = '%s';
 			$formatted_fields[] = $form;
+			$real_data[] = $data[$field];
 		}
 		$sql = "{$type} INTO `$table` (`" . implode( '`,`', $fields ) . "`) VALUES ('" . implode( "','", $formatted_fields ) . "')";
-		return $this->query( $this->prepare( $sql, $data ) );
+		return $this->query( $this->prepare( $sql, $real_data ) );
 	}

 	/**
@@ -1237,7 +1244,13 @@

 		$formats = $format = (array) $format;
 		$bits = $wheres = array();
+		$real_data = array();
 		foreach ( (array) array_keys( $data ) as $field ) {
+			if ( $data[$field] === null ) {
+				$bits[] = "`$field` = NULL";
+				array_shift( $formats );
+				continue;
+			}
 			if ( !empty( $format ) )
 				$form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
 			elseif ( isset($this->field_types[$field]) )
@@ -1245,6 +1258,7 @@
 			else
 				$form = '%s';
 			$bits[] = "`$field` = {$form}";
+			$real_data[] = $data[$field];
 		}

 		$where_formats = $where_format = (array) $where_format;
@@ -1259,7 +1273,7 @@
 		}

 		$sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres );
-		return $this->query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ) );
+		return $this->query( $this->prepare( $sql, array_merge( array_values( $real_data ), array_values( $where ) ) ) );
 	}

 	/**
