Global warming and its associated increase in temperature extremes pose a substantial challenge on natural systems. Tropical ectotherms, living close to their (upper) critical thermal limits, may be particularly vulnerable to global warming, yet they are as a group understudied. Most studies assessing fitness effects under global warming focused on life-history correlates such as body size and largely neglected immune function. Furthermore they did not consider to what extent temperature effects may be modulated under resource-based trade-offs. Against this background we here investigate effects of temperature extremes on fitness-related adult traits (viz. body mass, fat content, and two key parameters of arthropod immune function: phenoloxidase (PO) activity and haemocyte numbers) at different levels of larval and adult food stress in the tropical butterfly Bicyclus anynana. Body mass and PO activity decreased after short-term larval food stress, but not fat content and haemocyte numbers (probably owing to compensatory mechanisms during further development). Longer-term food deprivation in the adult stage, in contrast, diminished performance throughout, confirming that the feeding treatments chosen imposed stress. Temperature manipulations yielded contrary responses between life-history correlates and immune function: while body mass and fat content increased by increasing temperatures, PO activity and haemocyte numbers decreased. The latter was particularly pronounced under adult food stress, suggesting a resource-allocation trade-off. Our data suggest that global warming will not only reduce performance through direct effects of thermal stress, but also through secondary effects on adult immune function, which may be missed when exclusively focussing on other life-history correlates.