The acid-catalyzed condensation between 2-aminosubstituted [1,2,4]triazolo[1,5-a]pyrimidines and their analogues with various saturation of the pyrimidine ring and 1,3-diketones or 1,1,3,3-tetramethoxypropane was evaluated as a new approach for the synthesis of diversely substituted polycyclic derivatives of triazolopyrimidine. The reaction of 4,5,6,7-tetrahydro- or aromatic aminotriazolopyrimidines results in selective formation of the corresponding [1,2,4]triazolo[1,5-a:4,3-a']dipyrimidin-5-ium salts, and the condensation of substrates containing the 4,7-dihydro-[1,2,4]triazolo[1,5-a]pyrimidine fragment is accompanied by a cascade rearrangement with unusual recyclization of the dihydropyrimidine ring to yield partially hydrogenated [1,2,4]triazolo[1,5-a:4,3-a']dipyrimidin-5-ium or pyrimido[1',2':1,5][1,2,4]triazolo[3,4-b]quinazolin-5-ium salts. The proposed methodology exhibits a wide scope, providing rapid access to polycondensed derivatives of the [1,2,4]triazolo[1,5-a]pyrimidine scaffold. DFT calculations of the Gibbs free energies of possible isomers were performed to rationalize the experimentally observed reactivity and selectivity.