r3874: Fix ref counting of thumbnails put into the cache