Index: /Users/simon/Projects/StephenFry/site/wordpress/wp-includes/post.php
===================================================================
--- /Users/simon/Projects/StephenFry/site/wordpress/wp-includes/post.php	(revision 11743)
+++ /Users/simon/Projects/StephenFry/site/wordpress/wp-includes/post.php	(working copy)
@@ -2603,10 +2603,10 @@
 
 	$uploadPath = wp_upload_dir();
 
-	if ( ! empty($meta['thumb']) ) {
+	if ( ! empty($meta['sizes']['thumbnail']) ) {
 		// Don't delete the thumb if another attachment uses it
-		if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%'.$meta['thumb'].'%', $postid)) ) {
-			$thumbfile = str_replace(basename($file), $meta['thumb'], $file);
+		if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%'.$meta['sizes']['thumbnail']['file'].'%', $postid)) ) {
+			$thumbfile = str_replace(basename($file), $meta['sizes']['thumbnail']['file'], $file);
 			$thumbfile = apply_filters('wp_delete_file', $thumbfile);
 			@ unlink( path_join($uploadPath['basedir'], $thumbfile) );
 		}
