Heterojunctions formed from LaFeO3 (LFO) and STO since LFO has one of the highest known antiferromagnetic ordering temperatures, and, moreover, is almost perfectly lattice matched with STO. LFO films were grown by oxygen plasma assisted molecular beam epitaxy (MBE) in a deposition chamber with a base pressure of 10-10mbar on STO (SrTiO3) (001) substrates that were prepared in two distinct ways. In both cases, the substrates were TiO2 terminated. In each case, the substrates underwent sequential cleaning with acetone, methanol, and deionized water, in an ultrasonic bath, each for 15 min, followed by dipping in 1:7 buffered hydrofluoric acid (BHF) with NH4F for =28 s to etch away the surface SrO layer. Next, the STO substrates were rinsed in deionized water to remove residual BHF, and then dried in hot nitrogen gas. A substrates while those STO substrates that underwent an additional annealing procedure in a tube furnace at 1000°C in flowing oxygen at a pressure of greater than 1 atm for 90 min are referred to as type B. It was observed that the presence or absence of a 2DEG at an interface between LFO(001) and STO(001), for LFO layers above a critical thickness of =3 u.c., which STEM and SXRD show is nearly ideal, namely, epitaxial and atomically smooth, in both cases. The ideal interface we calculate should display a 2DEG, independent of the LFO thickness. From detailed experimental studies and theoretical models we show that the 2DEG is a result of a complex interplay between cation intermixing in 1-2 interface layers and oxygen vacancies in the same layers. We show that ionic liquid gating can, through changes in the oxygen vacancy concentration, control the presence of the 2DEG.