One-photon mass-analyzed threshold ionization (MATI) spectroscopy of jet-cooled oxazole and thiazole has been carried out to give the precise adiabatic ionization energies of 9.5959 +/- 0.0006 and 9.3633 +/- 0.0009 eV, respectively. The structural change upon ionization has been revealed in the vibrationally resolved one-photon MATI spectra. Simulations based on the Franck-Condon analysis using the molecular structures calculated by the density functional theory reproduce the experiment very well for both molecules. The ionization-driven structural change of thiazole is quite different from that of oxazole in terms of the detailed geometrical shape, ascribed to the difference in the pi-conjugation nature of two molecules. The role of oxygen and sulfur in the stabilization of heterocyclic systems is discussed through the inspection of the calculated molecular orbitals involved in the photoionization.