You'll need to eval() the header/footer/headinclude again since it's a different template now.
Code:
eval('$header = "'.gettemplate('header').'";');
And so on for the mentioned templates. But you this might not work because it will pull the cached version fo the template, which isn't the right one. Hmm... then before doing that put:
Code:
unset($templatecache['header']);
And it should work.