diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 4d4c9bc..5cb54e9 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -853,17 +853,44 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
 	if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent )
 		return get_page_of_comment( $comment->comment_parent, $args );
 
-	$allowedtypes = array(
-		'comment' => '',
-		'pingback' => 'pingback',
-		'trackback' => 'trackback',
-	);
-
-	$comtypewhere = ( 'all' != $args['type'] && isset($allowedtypes[$args['type']]) ) ? " AND comment_type = '" . $allowedtypes[$args['type']] . "'" : '';
-
-	// Count comments older than this one
+	switch ( $args['type'] ) {
+		case 'comment':
+			$comtype = 'comment';
+			$comtypewhere = " AND comment_type = ''";
+			break;
+		case 'pingback':
+			$comtype = 'pingback';
+			$comtypewhere = " AND comment_type = 'pingback'";
+			break;
+		case 'trackback':
+			$comtype = 'trackback';
+			$comtypewhere = " AND comment_type = 'trackback'";
+			break;
+		case 'pings':
+			$comtype = 'pings';
+			$comtypewhere = " AND ( comment_type = 'pingback' OR comment_type = 'trackback' )";
+			break;
+		default;
+			$comtype = 'all';
+			$comtypewhere = '';
+	}
+ 
+	$cachekey = 'post-' . $comment->comment_post_ID;
+	// Check the cache and set it up if it's not set (so we can use replace later on)
+	if ( false === $oldercoms_cache = wp_cache_get( $cachekey, 'comment_pages' ) ) {
+		$oldercoms_cache = array();
+		wp_cache_add( $cachekey, $oldercoms_cache, 'comment_pages' );
+	}
+	$oldercoms_cache = (array) $oldercoms_cache;
+ 
+	// Get comments older than this comment
+	$oldercoms = ( isset( $oldercoms_cache[$comtype] ) && isset( $oldercoms_cache[$comtype][$comment->comment_ID] ) ) ? $oldercoms_cache[$comtype][$comment->comment_ID] : false;
+	if ( false === $oldercoms ) {
 	$oldercoms = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_approved = '1' AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, $comment->comment_date_gmt ) );
-
+		$oldercoms_cache[$comtype][$comment->comment_ID] = $oldercoms;
+		wp_cache_replace( $cachekey, $oldercoms_cache, 'comment_pages' );
+	}
+ 
 	// No older comments? Then it's page #1.
 	if ( 0 == $oldercoms )
 		return 1;
@@ -873,6 +900,22 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
 }
 
 /**
+ * Clears the cache used by get_page_of_comment(). Is designed to be attached to the
+ * 'clear_page_of_comment_cache' action inside of wp_transition_comment_status();
+ *
+ * @since 2.9.0
+ * @uses wp_cache_delete() Does the cache deleting.
+ *
+ * @param string $new_status Unused
+ * @param string $old_status Unused
+ * @param object $comment Comment object that had it's status changed
+ * @return bool True on successful removal, false on failure
+ */
+function clear_page_of_comment_cache( $new_status, $old_status, $comment ) {
+        return wp_cache_delete( 'post-' . $comment->comment_post_ID, 'comment_pages' );
+}
+
+/**
  * Does comment contain blacklisted characters or words.
  *
  * @since 1.5.0
diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
index 89b3976..60f4dbf 100644
--- a/wp-includes/default-filters.php
+++ b/wp-includes/default-filters.php
@@ -259,6 +259,7 @@ add_action( 'transition_post_status',     '_update_term_count_on_transition_post
 add_action( 'comment_form',               'wp_comment_form_unfiltered_html_nonce'          );
 add_action( 'wp_scheduled_delete',        'wp_scheduled_delete'                            );
 add_action( 'wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts'                      );
+add_action( 'transition_comment_status',  'clear_page_of_comment_cache',             10, 3 );
 add_action( 'admin_init',                 'send_frame_options_header',               10, 0 );
 add_action( 'importer_scheduled_cleanup', 'wp_delete_attachment'                           );
 add_action( 'upgrader_scheduled_cleanup', 'wp_delete_attachment'                           );
