Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 108985)
+++ wp-includes/post.php	(working copy)
@@ -229,10 +229,17 @@
 	 */
 	$file = apply_filters( 'update_attached_file', $file, $attachment_id );
 
-	if ( $file = _wp_relative_upload_path( $file ) )
-		return update_post_meta( $attachment_id, '_wp_attached_file', $file );
-	else
+	$file = _wp_relative_upload_path( $file );
+
+	if ( ! $file ) {
 		return delete_post_meta( $attachment_id, '_wp_attached_file' );
+	}
+
+	if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE ) {
+		update_post_meta( $attachment_id, '_wp_attached_file', 'temp' . time() );
+	}
+
+	return update_post_meta( $attachment_id, '_wp_attached_file', $file );
 }
 
 /**
