Protein and carbohydrate are the two most important macronutrients that have profound consequences for the fitness of insects. Many insects are capable of balancing the intake of multiple nutrients to minimize the fitness costs associated with ingesting diets that are imbalanced with respect to protein and carbohydrate. It has been hypothesized that insects will redress the imbalance of their nutrient state through increasing the appetite for specific nutrients that are ingested in deficit. We tested this possibility using a mealworm beetle, Tenebrio molitor (Coleoptera: Tenebrionidae). Newly emerged beetles were confined to one of two nutritionally imbalanced foods that contained only protein or carbohydrate (P:C ratio = 0:42 and 42:0, expressed as % dry mass) for 16 days, after which they were given an opportunity to choose between two nutritionally imbalanced diets (0:42 versus 42:0). Over the first few days of the food choice, beetles that had previously experienced protein-limitation preferred protein to carbohydrate while the reverse was true for those that had experienced carbohydrate-shortage. Such contrasting patterns of diet preference observed between the two groups of beetles diminished subsequently as the insects recovered from nutrient imbalance. Our results provide strong support for the long-standing idea that attaining the right balance of nutrients is the main motive for foraging in insects.