Around discontinuous (first-order) magnetic phase transitions the strong caloric response of materials to the application of small fields is widely studied for the development of solid-state refrigeration. Typically strong magnetostructural coupling drives such transitions and the attendant substantial hysteresis dramatically reduces the cooling performance. In this context we describe a purely electronic mechanism which pilots a first-order paramagnetic-ferromagnetic transition in divalent lanthanide compounds and which explains the giant non-hysteretic magnetocaloric effect recently discovered in a Eu$_2$In compound. There is positive feedback between the magnetism of itinerant valence electrons and the ferromagnetic ordering of local $f$-electron moments, which appears as a topological change to the Fermi surface. The origin of this electronic mechanism stems directly from Eus divalency, which explains the absence of a similar discontinuous transition in Gd$_2$In.