How to query for parent theme(s)?
This is how Display Suite does it:

// Get layouts defined in the default theme and base theme (if applicable).
$theme = variable_get('theme_default');
$themes = list_themes();

$base_theme = array();
$ancestor = $theme;
while ($ancestor &amp;&amp; isset($themes[$ancestor]-&gt;base_theme)) {
  $ancestor = $themes[$ancestor]-&gt;base_theme;
  $base_theme[] = $themes[$ancestor];
}