Understanding how environmental temperature affects metabolic and physiological functions is of crucial importance to assess the impacts of climate change on organisms. Here, we used different laboratory strains and a wild-caught population of the fruit fly Drosophila melanogaster to examine the effect of temperature on the body energy reserves of an ectothermic organism. We found that permanent ambient temperature elevation or transient thermal stress causes significant depletion of body fat stores. Surprisingly, transient thermal stress induces a lasting "memory effect" on body fat storage, which also reduces survivorship of the flies upon food deprivation later after stress exposure. Functional analyses revealed that an intact heat-shock response is essential to protect flies from temperature-dependent body fat decline. Moreover, we found that the temperature-dependent body fat reduction is caused at least in part by apoptosis of fat body cells, which might irreversibly compromise the fat storage capacity of the flies. Altogether, our results provide evidence that thermal stress has a significant negative impact on organismal energy reserves, which in turn might affect individual fitness.