Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 18599)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -1545,6 +1545,39 @@
 	echo json_encode( array( 'message' => $message, 'last_edited' => $last_edited ) );
 	die();
 	break;
+case 'wp-remove-post-lock' :
+
+	$post_id = isset($_POST['post_ID']) ? (int) $_POST['post_ID'] : 0;
+	if ( !current_user_can('edit_post', $post_id) || empty($_POST['user_ID']) )
+		die();
+
+	$post = $post_type = null;
+
+	if ( $post_id ) {
+		$post = get_post($post_id);
+		if ( $post )
+			$post_type = $post->post_type;
+	}
+
+	check_ajax_referer('update-' . $post_type . '_' . $post_id);
+
+	sleep(4);
+
+	if ( !$lock = get_post_meta( $post_id, '_edit_lock', true ) )
+		die('-1');
+
+	$lock = explode( ':', $lock );
+	$user_id = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post_id, '_edit_last', true );
+	$locked = (int) $lock[0];
+
+	if ( time() - $locked < 5 ) // give a few seconds for the lock to be refreshed if the user reloaded the page
+		die('0');
+
+	if ( $user_id == $_POST['user_ID'] )
+		delete_post_meta( $post_id, '_edit_lock' );
+
+	die('1');
+	break;
 default :
 	do_action( 'wp_ajax_' . $_POST['action'] );
 	die('0');
Index: wp-admin/js/post.dev.js
===================================================================
--- wp-admin/js/post.dev.js	(revision 18599)
+++ wp-admin/js/post.dev.js	(working copy)
@@ -643,4 +643,18 @@
 	}
 
 	wptitlehint();
+
+	// remove the post lock on unload
+	$(window).unload(function() {
+		$.ajax({
+			type: 'POST',
+			url: ajaxurl,
+			data: {
+				action: 'wp-remove-post-lock',
+				_wpnonce: $('#_wpnonce').val(),
+				post_ID: $('#post_ID').val(),
+				user_ID: $('#user_ID').val()
+			}
+		});
+	});
 });
Index: wp-includes/script-loader.php
===================================================================
--- wp-includes/script-loader.php	(revision 18599)
+++ wp-includes/script-loader.php	(working copy)
@@ -281,7 +281,7 @@
 
 		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110822', 1 );
 
-		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110524', 1 );
+		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110824', 1 );
 		$scripts->add_script_data( 'post', 'postL10n', array(
 			'ok' => __('OK'),
 			'cancel' => __('Cancel'),
