The reactions of β-lactam carbenes with both 3,6-di(2-pyridyl)tetrazine and 3,6-di(4-pyridyl)tetrazine were studied. It was found that β-lactam carbenes reacted with 3,6-di(2-pyridyl)tetrazine to produce 5-triazolo[1,5-a]pyridylpyrrol-2-ones in good yields, while with 3,6-di(4-pyridyl)tetrazine, they afforded pyrido[c]cyclopenta[b]pyrrol-2-ones in moderate yields. Both reactions were proposed to follow cascade mechanisms containing a 3,6a-dipyridylpyrrolo[3,2-c]pyrazol-5-one intermediate. The different pathways of the transformation of pyrrolo[3,2-c]pyrazol-5-ones were switched by the 2- and 4-pyridyl substituents. This work not only provided a simple and efficient strategy for the construction of novel triazolo[1,5-a]pyridine and pyrido[c]cyclopenta[b]pyrrole derivatives, respectively, but also revealed two different thermal transformation patterns of 3H-pyrazole compounds.