Solar wind electrons play an important role in the energy balance of the solar wind acceleration by carrying energy into interplanetary space in the form of electron heat flux. The heat flux is stored in the complex electron velocity distribution functions (VDFs) shaped by expansion, Coulomb collisions, and field-particle interactions. We investigate how the suprathermal electron deficit in the anti-strahl direction, which was recently discovered in the near-Sun solar wind, drives a kinetic instability and creates whistler waves with wave vectors that are quasi-parallel to the direction of the background magnetic field. We combined high-cadence measurements of electron pitch-angle distribution functions and electromagnetic waves provided by Solar Orbiter during its first orbit. Our case study is based on a burst-mode data interval from the Electrostatic Analyser System (SWA-EAS) at a distance of 112 RS (0.52 au) from the Sun, during which several whistler wave packets were detected by Solar Orbiter’s Radio and Plasma Waves (RPW) instrument. The sunward deficit creates kinetic conditions under which the quasi-parallel whistler wave becomes unstable. We directly test our predictions for the existence of these waves through solar wind observations. We find whistler waves that are quasi-parallel and almost circularly polarised, propagating away from the Sun, coinciding with a pronounced sunward deficit in the electron VDF. The cyclotron-resonance condition is fulfilled for electrons moving in the direction opposite to the direction of wave propagation, with energies corresponding to those associated with the sunward deficit. The quasilinear diffusion of the resonant electrons tends to fill the deficit, leading to a reduction in the total electron heat flux.