Index: wp-includes/js/media-editor.js
===================================================================
--- wp-includes/js/media-editor.js	(revision 22833)
+++ wp-includes/js/media-editor.js	(working copy)
@@ -448,7 +448,8 @@
 				return media.post( 'send-attachment-to-editor', {
 					nonce:      wp.media.view.settings.nonce.sendToEditor,
 					attachment: options,
-					html:       html
+					html:       html,
+					post_id:    wp.media.view.settings.postId
 				}).done( function( resp ) {
 					wp.media.editor.insert( resp );
 				});
Index: wp-admin/includes/ajax-actions.php
===================================================================
--- wp-admin/includes/ajax-actions.php	(revision 22834)
+++ wp-admin/includes/ajax-actions.php	(working copy)
@@ -1931,6 +1931,11 @@
 	if ( 'attachment' != $post->post_type )
 		wp_send_json_error();
 
+	// If this attachment is unattached, attach it. Primarily a back compat thing.
+	if ( 0 == $post->post_parent && $insert_into_post_id = intval( $_POST['post_id'] ) ) {
+		wp_update_post( array( 'ID' => $id, 'post_parent' => $insert_into_post_id ) );
+	}
+
 	$html = isset( $attachment['title'] ) ? $attachment['title'] : '';
 	if ( ! empty( $attachment['url'] ) ) {
 		$rel = '';
