Index: wp-admin/customize.php
===================================================================
--- wp-admin/customize.php	(revision 21024)
+++ wp-admin/customize.php	(working copy)
@@ -11,6 +11,8 @@
 if ( ! current_user_can( 'edit_theme_options' ) )
 	wp_die( __( 'Cheatin&#8217; uh?' ) );
 
+wp_reset_vars( array( 'url' ) );
+
 global $wp_scripts, $wp_customize;
 
 $registered = $wp_scripts->registered;
@@ -64,7 +66,7 @@
 				submit_button( $save_text, 'primary', 'save', false );
 			?>
 			<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" />
-			<a class="back button" href="<?php echo esc_url( admin_url( 'themes.php' ) ); ?>">
+			<a class="back button" href="<?php echo esc_url( $url ? urldecode( $url ) : admin_url( 'themes.php' ) ); ?>">
 				<?php _e( 'Cancel' ); ?>
 			</a>
 		</div>
@@ -146,7 +148,7 @@
 			'active'     => $wp_customize->is_theme_active(),
 		),
 		'url'      => array(
-			'preview'       => esc_url( home_url( '/' ) ),
+			'preview'       => esc_url( $url ? $url : home_url( '/' ) ),
 			'parent'        => esc_url( admin_url() ),
 			'activated'     => esc_url( admin_url( 'themes.php?activated=true' ) ),
 			'ajax'          => esc_url( admin_url( 'admin-ajax.php', 'relative' ) ),
Index: wp-includes/admin-bar.php
===================================================================
--- wp-includes/admin-bar.php	(revision 21024)
+++ wp-includes/admin-bar.php	(working copy)
@@ -576,11 +576,12 @@
 	if ( ! current_user_can( 'edit_theme_options' ) )
 		return;
 
+	$current_url = is_ssl() ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
 	$wp_admin_bar->add_menu( array(
 		'parent' => 'appearance',
 		'id'     => 'customize',
 		'title'  => __('Customize'),
-		'href'   => wp_customize_url(),
+		'href'   => add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ),
 		'meta'   => array(
 			'class' => 'hide-if-no-customize',
 		),
