Cyclization of 2-hydrazino-5,6-dimethyl-3H-thieno[2,3-d]pyrimidin-4-one (1) with acetic acid gave 3,6,7-trimethyl-l,2,4-triazolo[3,4-a]thieno[2,3-d] pyrimidin-5-one (5) whose Dimroth rearrangement gave 2,6,7-trimethyl-l,2,4-triazolo[3,4-a]thieno[2,3-d]pyrimidin-5-one (11). Alternatively, 5 was obtained from the dehydrogenative cyclization of acetaldehyde 5,6- dimethyl-4-3H-oxo-thieno[2,3-d]pyrimidin-2-yl hydrazone (7). Reaction of 1 and 2 with a number of sugars gave the respective hydrazones 19 and 20. Those of the D-glucose exist in the cyclic pyranosyl structure in addition to minor amounts of the acyclic structure. Dehydrogenative cyclization of the sugar hydrazones gave the respective fused tricyclic compounds 25 and 26