Two ortho-hetarynium ions, the 2-pyridyl and 2-pyrimidyl cations, react promptly with 1,3-dienes in the gas phase by annulation, formally by fusion, onto the ions of a pyrrole ring. This novel reaction proceeds through an initial polar [4 + 2+] cycloaddition across the C[triple bond]N+ bond, followed by fast ring opening, a [1,4-H] shift, and finally a recyclization that results in a contraction of a six- to a five-membered ring and dissociation by the loss of a methyl radical. For the 2-pyridyl cation, this reaction yields ionized indolizines (pyrrolo[1,2-a]pyridines), while for the 2-pyrimidyl cation, it gives ionized pyrrolo[1,2-a]pyrimidines. The annulation reaction, performed in the rf-only collision quadrupole of a pentaquadrupole (QqQqQ) mass spectrometer, occurs readily with both 1,3-butadiene and isoprene, and is thermodynamically and kinetically favored as predicted by ab initio calculations. Ortho-hetarynium ions and 1,3-dienes provide, therefore, the two building blocks for the efficient one-step gas-phase synthesis of ionized bicyclic pyrrolo[1,2-a]pyridine (indolizine) and pyrrolo[1,2-a]pyrimidine, as well as their analogues and derivatives.