Page Caching wrong CSS got a weird issue I was hoping someone could help with.

I have a site that uses multiple subthemes, with different ones being served depending on url var. IE, subsiteone.mysite.com, and subsitetwo.mysite.com get different themes, but the same content.

I am using a module to style each subtheme css via theme settings (https://www.drupal.org/project/style_settings) and am having issues pages caching the wrong stylesheet.

The module setup works fine, rewriting modified css to files/style_settings/subthemeone.css


On initial save, all is fine, and page pulls correct (rewritten)
files/style_settings/subthemeone.css path. 
After a while, page caches    (?) and reverts css reference to the
old (unwritten)    sites/all/themes/subthemeone/subthemeone.css


Clearing drupal cache results in the correct (rewritten) reference being called again. Would love to NOT have to resort to disabling caching/etc, so any thoughts appreciated!

EDIT: Using slightly modified code graciously provided below:

style_settings.module

function style_settings_init() {
      setcookie('custom_theme', $GLOBALS['theme'], REQUEST_TIME + 60*60*24*30, ini_get('session.cookie_path'), ini_get('session.cookie_domain'));
}


settings.php

// Check if cookie is set.
if (!empty($_COOKIE['custom_theme'])) {
  // Add theme name to page cache id.
  $_SERVER['REQUEST_URI'] .= '#' . $_COOKIE['custom_theme'];
  // Set Theme.
  $conf['theme_default'] = $_COOKIE['custom_theme'];
  //drupal_set_message($conf['theme_default'], 'status');
}
// Disable page cache if cookie not set so module can set the cookie.
else {
  $conf['cache'] = CACHE_DISABLED;
}
Answer is in here: https://www.drupal.org/node/361832#comment-4204294

You'll need a cookie for the user saying what theme they are using. This is done in a hook_init() call.

  // If no cookie is set, set a cookie with the value of theme_default.
  if (empty($_COOKIE['custom_theme'])) {
    setcookie('custom_theme', $GLOBALS['theme'], REQUEST_TIME + 60*60*24*30, ini_get('session.cookie_path'), ini_get('session.cookie_domain'));
  }


Then you'll need to modify the page cache cid ($_SERVER['REQUEST_URI']) in settings.php

// Check if cookie is set.
if (!empty($_COOKIE['custom_theme'])) {
  // Add theme name to page cache id.
  $_SERVER['REQUEST_URI'] .= '#' . $_COOKIE['custom_theme'];
  // Set Theme.
  $conf['theme_default'] = $_COOKIE['custom_theme'];
}
// Disable page cache if cookie not set so switchtheme can set the cookie.
else {
  $conf['cache'] = CACHE_DISABLED;
}


Code is from D6 but looking it over really quickly it should work for D7.