We analyze recent measurements [R. Blinc, V. V. Laguta, B. Zalar, M. Itoh and H. Krakauer, J. Phys. : Cond. Mat., v.20, 085204 (2008)] of the electric field gradient on the oxygen site in the perovskites SrTiO3 and BaTiO3, which revealed, in agreement with calculations, a large difference in the EFG for these two compounds. In order to analyze the origin of this difference, we have performed density functional electronic structure calculations within the local-orbital scheme FPLO. Our analysis yields the counter-intuitive behavior that the EFG increases upon lattice expansion. Applying the standard model for perovskites, the effective two-level p-d Hamiltonian, can not explain the observed behavior. In order to describe the EFG dependence correctly, a model beyond this usually sufficient p-d Hamiltonian is needed. We demonstrate that the counter-intuitive increase of the EFG upon lattice expansion can be explained by a s-p-d model, containing the contribution of the oxygen 2s states to the crystal field on the Ti site. The proposed model extension is of general relevance for all related transition metal oxides with similar crystal structure.