Index: post.php
===================================================================
--- post.php	(revision 24432)
+++ post.php	(working copy)
@@ -3072,11 +3072,18 @@
 		$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
 		$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
 
+		if ( ! $post_name_check && '/%postname%/' == $wp_rewrite->permalink_structure )
+			$post_name_check = get_page_by_path( $slug );
+
 		if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
 			$suffix = 2;
 			do {
 				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
 				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) );
+				
+				if ( ! $post_name_check && '/%postname%/' == $wp_rewrite->permalink_structure )
+					$post_name_check = get_page_by_path( $alt_post_name );
+				
 				$suffix++;
 			} while ( $post_name_check );
 			$slug = $alt_post_name;
