T3P–DMSO mediated desulfurative cyclization of in situ generated thioamides serves as an efficient and versatile method for the synthesis of imidazo[1,5-a]pyridines and [1,2,4]-triazolo[4,3-a]pyridines with good to excellent yields. Substrates such as 2-methylaminoquinoline and pyrazin-2-yl-methanamine also undergo the corresponding reactions at room temperature. This efficient protocol has several advantages such as mild conditions, short reaction time, operational simplicity and high yields.