Why does this BJT logic circuit only function intermittently?
The problem is the PN junction from the base to collector or T4.  When T5 is off, the emitter of T4 is floating.  If you now apply a high voltage to the left end of R5, T4 acts like a diode from base to collector.  This turns on T6 directly from the high output of T3.

Put another way, the NAND gate formed by T4 and T5 has a bug.  It doesn't work when the T4 input is high and the T5 input low.  Your overall logic was right, but due to T5 being off, T4 doesn't work like the transistor you are assuming anymore.

To make a NAND gate, just flip your NOR gate around using PNP instead of NPN:



By the way, this whole problem goes away if you use logic-level N-channel MOSFETS instead of NPN transistors.  You can stack those and get what you intended.