hey ainars
I had exactly the same problem with image cache... this problem seems to persist mostly in Internet Explorer browsers, the header() function that you have would probably work for mozilla....
this is what i did to overcome this problem... i generated a file with a unique filename.... and that's it !!! meaning that the image filename was different each time it got generated... you may use php function uniqid() which generates a unique string based on time, additianally you can do rand() to make sure that the filenames are totally unique.....
<?php
$uniqid = uniqid("",false);
$filename = session_id() . "_" . $uniqid;
?>
have a look at www.php.net/uniqid
hope that helped you 😃