Index: wp-includes/general-template.php
===================================================================
--- wp-includes/general-template.php	(revision 15775)
+++ wp-includes/general-template.php	(working copy)
@@ -116,16 +116,35 @@
  * @param string $slug The slug name for the generic template.
  * @param string $name The name of the specialised template.
  */
-function get_template_part( $slug, $name = null ) {
-	do_action( "get_template_part_{$slug}", $slug, $name );
+function get_template_part( $slug, $name = null, $directory = null ) {
+	if ( false !== strpos( $slug, DIRECTORY_SEPARATOR ) ) {
+		$original_slug = $slug;
+		$slug = substr( strrchr( $slug, DIRECTORY_SEPARATOR ), 1 );
+		if ( empty( $directory ) ) {
+			$directory = substr( $original_slug, 0, strrpos( $original_slug, DIRECTORY_SEPARATOR ) );
+		}
+	}
+	$slug = sanitize_file_name( $slug );
 
+	// @todo sanitize here
+	$directory = rtrim( $directory, DIRECTORY_SEPARATOR );
+
+	do_action( "get_template_part_{$slug}", $slug, $name, $directory );
+
 	$templates = array();
+	if ( ! empty( $directory ) ) {
+		if ( isset($name) )
+			$templates[] = $directory . DIRECTORY_SEPARATOR . "{$slug}-{$name}.php";
+
+		$templates[] = $directory . DIRECTORY_SEPARATOR . "{$slug}.php";
+	}
+
 	if ( isset($name) )
 		$templates[] = "{$slug}-{$name}.php";
 
 	$templates[] = "{$slug}.php";
 
-	locate_template($templates, true, false);
+	locate_template( $templates, true, false );
 }
 
 /**
