To answer about the caching: I'm pretty sure from a skim of the code that the first time an image is successfully read – from either the theme's folder in the Moodle source code or from the site files in filedir in Moodledata – it gets saved to localcache for next time.
Since src="preferences," isn't resulting in the correct image file being read then there's no file to save to the t folder.