Nonisothermal electron transport in thin barrier heterostructures is investigated using Monte Carlo techniques. Particular attention is paid to the energy balance in thermionic emission, and the Joule heating in the barrier region. By introducing an energy relaxation length, an equation for the temperature distribution inside the device is derived. Conditions for creating a steady-state temperature gradient and for integrated cooling of electronic components are examined.