The methods of small angle synchrotron radiation scattering, vibration spectroscopy, and second harmonic generation are applied to glasses of the K2O-TiO2-P2O5 system near the stoichiometry of potassium titanyl-phosphate to demonstrate that at the initial stage of phase separation, while glass remains x-ray amorphous and clear, it can possess quadratic optical nonlinearity. The emergence of nonlinearity is facilitated by the formation of nanoheterogeneities in glass whose structure resembles the structural pattern of a nonlinear-optical crystal. Acorrelation established between the structural specifics of x-ray amorphous glass and its quadratic optical nonlinearly suggests the advisability of describing the short-range and medium-range orders of glasses at the glass-formation boundary in the context of quasicrystallite models.