Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 11673)
+++ wp-includes/post.php	(working copy)
@@ -2555,6 +2555,9 @@
 
 	clean_post_cache($post_ID);
 
+	if ( isset($post_parent) && $post_parent < 0 )
+		add_post_meta($post_ID, '_wp_attachment_temp_parent', $post_parent, true);
+
 	if ( $update) {
 		do_action('edit_attachment', $post_ID);
 	} else {
Index: wp-admin/includes/post.php
===================================================================
--- wp-admin/includes/post.php	(revision 11673)
+++ wp-admin/includes/post.php	(working copy)
@@ -759,7 +759,18 @@
 	global $wpdb;
 	$old_ID = (int) $old_ID;
 	$new_ID = (int) $new_ID;
-	return $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('post_parent' => $old_ID) );
+	
+	$children = $wpdb->get_col("
+		SELECT post_id
+		FROM $wpdb->postmeta
+		WHERE meta_key = '_wp_attachment_temp_parent'
+		AND meta_value = $old_ID
+	");
+
+	foreach ( $children as $child_id ) {
+		$wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('ID' => $child_id) );
+		delete_post_meta($child_id, '_wp_attachment_temp_parent');
+	}
 }
 
 /**

