How to get only parent term ids of a given term, without loading the terms
Have a look at taxonomy_get_parents() and taxonomy_get_parents_all().

You could copy most of the functions but skip

$parents[$tid] = taxonomy_term_load_multiple($tids);


to not load the terms.

/**
 * Load a terms parent.
 */
function MODULE_taxonomy_get_parents($tid) {
  $parents = &amp;drupal_static(__FUNCTION__, array());

  if ($tid &amp;&amp; !isset($parents[$tid])) {
    $query = db_select('taxonomy_term_data', 't');
    $query-&gt;join('taxonomy_term_hierarchy', 'h', 'h.parent = t.tid');
    $query-&gt;addField('t', 'tid');
    $query-&gt;condition('h.tid', $tid);
    $query-&gt;addTag('term_access');
    $query-&gt;orderBy('t.weight');
    $query-&gt;orderBy('t.name');
    // $tids = $query-&gt;execute()-&gt;fetchCol();
    // $parents[$tid] = taxonomy_term_load_multiple($tids);
    $tids = $query-&gt;execute()-&gt;fetchAll();
    $parents[$tid] =  $tids;
  }

  return isset($parents[$tid]) ? $parents[$tid] : array();    
}

/**
 * Load all parents for a term.
 */
function MODULE_taxonomy_get_parents_all($tid) {
  $cache = &amp;drupal_static(__FUNCTION__, array());

  if (isset($cache[$tid])) {
    return $cache[$tid];
  }

  $parents = array();
  if ($term = taxonomy_term_load($tid)) {
    $parents[] = $term;
    $n = 0;
    // while ($parent = taxonomy_get_parents($parents[$n]-&gt;tid)) {
    while ($parent = MODULE_taxonomy_get_parents($parents[$n]-&gt;tid)) {
      $parents = array_merge($parents, $parent);
      $n++;
    }
  }

  $cache[$tid] = $parents;

  return $parents;
}


If you don't need any access control or sorting you can just query the taxonomy_term_hierarchy table directly.

$query = db_select('taxonomy_term_hierarchy', 'h');
$query-&gt;addField('h', 'parent', tid);
$query-&gt;condition('tid', $tid);
$query-&gt;condition('parent', 0, '!=');
$tids = $query-&gt;execute()-&gt;fetchAll();
$parents[$tid] =  $tids;