Understanding the physiological mechanisms that limit animal thermal tolerance is crucial in predicting how animals will respond to increasingly severe heat waves. Despite their importance for understanding climate change impacts, these mechanisms underlying the upper thermal tolerance limits of animals are largely unknown. It has been hypothesized that the upper thermal tolerance in fish is limited by the thermal tolerance of the brain and is ultimately caused by a global brain depolarization. In this study, we developed methods for measuring the upper thermal limit (CTmax) in larval zebrafish (Danio rerio) with simultaneous recordings of brain activity using GCaMP6s calcium imaging in both free-swimming and agar-embedded fish. We discovered that during warming, CTmax precedes, and is therefore not caused by, a global brain depolarization. Instead, the CTmax coincides with a decline in spontaneous neural activity and a loss of neural response to visual stimuli. By manipulating water oxygen levels both up and down, we found that oxygen availability during heating affects locomotor-related neural activity, the neural response to visual stimuli, and CTmax. Our results suggest that the mechanism limiting the upper thermal tolerance in zebrafish larvae is insufficient oxygen availability causing impaired brain function.