We developed a computational model of the mushroom body (MB), a prominent region of multimodal integration in the insect brain, and tested the model’s performance for non-elemental associative learning in visual pattern avoidance tasks. We employ a realistic spiking neuron model and spike time dependent plasticity, and learning performance is investigated in closed-loop conditions. We show that the distinctive neuroarchitecture (divergence onto MB neurons and convergence from MB neurons, with an otherwise non-specific connectivity) is sufficient for solving non-elemental learning tasks and thus modulating underlying reflexes in context-dependent, heterarchical manner.