diff --git modules/forum/forum.module modules/forum/forum.module
index fffd0c7..5a95397 100644
--- modules/forum/forum.module
+++ modules/forum/forum.module
@@ -857,45 +857,57 @@ function _forum_topics_unread($term, $uid) {
 }
 
 function forum_get_topics($tid, $sortby, $forum_per_page) {
-  global $user, $forum_topic_list_header;
-
-  $forum_topic_list_header = array(
-    NULL,
-    array('data' => t('Topic'), 'field' => 'f.title'),
-    array('data' => t('Replies'), 'field' => 'f.comment_count'),
-    array('data' => t('Last reply'), 'field' => 'f.last_comment_timestamp'),
-  );
-
-  $order = _forum_get_topic_order($sortby);
-  for ($i = 0; $i < count($forum_topic_list_header); $i++) {
-    if ($forum_topic_list_header[$i]['field'] == $order['field']) {
-      $forum_topic_list_header[$i]['sort'] = $order['sort'];
-    }
-  }
-
-  $query = db_select('forum_index', 'f')->extend('PagerDefault')->extend('TableSort');
-  $query->fields('f');
-  $query
-    ->condition('f.tid', $tid)
-    ->addTag('node_access')
-    ->orderBy('f.sticky', 'DESC')
-    ->orderByHeader($forum_topic_list_header)
-    ->orderBy('f.last_comment_timestamp', 'DESC')
-    ->limit($forum_per_page);
+  global $user;
 
   $count_query = db_select('forum_index', 'f');
   $count_query->condition('f.tid', $tid);
   $count_query->addExpression('COUNT(*)');
   $count_query->addTag('node_access');
 
-  $query->setCountQuery($count_query);
-  $result = $query->execute();
-  $nids = array();
-  foreach ($result as $record) {
-    $nids[] = $record->nid;
-  }
-  if ($nids) {
-    $result = db_query("SELECT n.title, n.nid, n.type, n.sticky, n.created, n.uid, n.comment AS comment_mode, ncs.*, f.tid AS forum_tid, u.name, CASE ncs.last_comment_uid WHEN 0 THEN ncs.last_comment_name ELSE u2.name END AS last_comment_name FROM {node} n INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {forum} f ON n.vid = f.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {users} u2 ON ncs.last_comment_uid = u2.uid WHERE n.nid IN (:nids)", array(':nids' => $nids));
+  $result = $count_query->execute();
+
+  if ($result->rowCount()) {
+    global $forum_topic_list_header;
+    $forum_topic_list_header = array(
+      NULL,
+      array('data' => t('Topic'), 'field' => 'f.title'),
+      array('data' => t('Replies'), 'field' => 'ncs.comment_count'),
+      array('data' => t('Last reply'), 'field' => 'ncs.last_comment_timestamp'),
+    );
+
+    $order = _forum_get_topic_order($sortby);
+    for ($i = 0; $i < count($forum_topic_list_header); $i++) {
+      if ($forum_topic_list_header[$i]['field'] == $order['field']) {
+        $forum_topic_list_header[$i]['sort'] = $order['sort'];
+      }
+    }
+
+    $query = db_select('forum_index', 'f')->extend('PagerDefault')->extend('TableSort');
+    $query->addField('f', 'tid', 'forum_tid');
+
+    $query
+      ->addTag('node_access')
+      ->orderBy('f.sticky', 'DESC')
+      ->orderByHeader($forum_topic_list_header)
+      ->orderBy('f.created', 'DESC')
+      ->condition('f.tid', $tid)
+      ->limit($forum_per_page);
+
+    $query->join('node_comment_statistics', 'ncs', 'f.nid = ncs.nid');
+    $query->fields('ncs', array('cid', 'last_comment_uid', 'last_comment_timestamp','comment_count'));
+
+    $query->join('node', 'n', 'n.nid = ncs.nid');
+    $query->fields('n', array('title','nid','type','sticky','created','uid'));
+    $query->addField('n', 'comment', 'comment_mode');
+
+    $query->join('users', 'u', 'n.uid = u.uid');
+    $query->addField('u', 'name');
+
+    $query->join('users', 'u2', 'ncs.last_comment_uid = u2.uid');
+
+    $query->addExpression('CASE ncs.last_comment_uid WHEN 0 THEN ncs.last_comment_name ELSE u2.name END', 'last_comment_name');
+
+    $result = $query->execute();
   }
   else {
     $result = array();
