A systematic study of the reactions of dimethyl acetylenedicarboxylate (DMAD) and methyl propynoate with 5-mercaptoazoles and pyridine-2-thiones has been carried out and as a result, a number of novel imidazo[1,5-b]thiazin-4-ones 6a,b, pyrazolo[1,5-b] thiazin-4-ones 15a-f, imidazo[1,5-b]thiazol-4-ones 7a,b and thiazolo[3,2-a]pyridines 21a-c have been prepared. The influence of the size of the ring of the starting "cyclic" thioamides on the size of the fused ring in the reaction products has been established. The preferred formation of a six-membered thiazine ring took place in the reactions of 5-mercaptoazoles. In contrast, the five membered thiazolidine ring is formed in reactions of pyridine-2-thiones. In both cases the product is a five-membered ring fused to a six-membered heterocycle.