Index: wordpress-importer.php
===================================================================
--- wordpress-importer.php	(revision 461346)
+++ wordpress-importer.php	(working copy)
@@ -952,12 +952,21 @@
 		global $wpdb;
 		// make sure we do the longest urls first, in case one is a substring of another
 		uksort( $this->url_remap, array(&$this, 'cmpr_strlen') );
-
+		$replacements = array();
 		foreach ( $this->url_remap as $from_url => $to_url ) {
-			// remap urls in post_content
-			$wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)", $from_url, $to_url) );
-			// remap enclosure urls
-			$result = $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'", $from_url, $to_url) );
+			$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE %s", "%$from_url%" ) );
+			if ( count( $post_ids ) >  0 ) {
+				foreach ( $post_ids as $id ) {
+					$replacements[$id][$from_url] = $to_url;
+				}
+			}
+		}
+		foreach( $replacements as $post_id => $post_replacements ) {
+			$post = get_post( $post_id );
+			uksort( $post_replacements, array(&$this, 'cmpr_strlen') );
+			$new_post_content = str_replace( array_keys( $post_replacements ), array_values( $post_replacements ), $post->post_content );
+			if ( $new_post_content <> $post->post_content )
+				$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->posts} SET post_content = %s WHERE ID = %d", $new_post_content, $post_id ) );
 		}
 	}
 
