Reaction of methyl 2-aryl-5-(chlorosulfonyl)-1,3-oxazole-4-carboxylates with 1H-pyrazol-5-amines and 1H-1,2,4-triazol-5-amines proceeds with the participation of endocyclic aminoazole nitrogen atoms to yield products containing a primary amino group. Being treated by sodium hydride these products undergo a further transformation into the tricyclic compounds. It has been shown that the cyclocondensation pathway includes the Smiles rearrangement with extrusion of SO2 followed by the elimination of MeOH. This reaction sequence is a convenient approach to the synthesis of new annulated [1,3]oxazolo[5,4-d]pyrimidine derivatives.