I've definitely been stumped by some odd failures in both things before. And not just passing diode tests, but also passing on basic multifunction testers at low voltage.
I haven't seen much in the way of simple gain changes, but I've seen other stuff. I've seen quite a few noisy/crackling diodes and transistors test perfectly fine on basic test gear but play up in circuit. Or breaking down well below the specified limits but still well above your standard low voltage tester (e.g. 50V rated parts that eat shit at 20V). Leakage can also be a thing that doesn't show up on basic tests (though sometimes can depending on meter specifics and severity of fault).
Hell, last week I had a REALLY weird one- I tested a suspect transistor in circuit and it was OK on diode tests. Wasn't convinced so I pulled it out and checked it on one of those little eBay transistor testers, it passed as a PNP transistor. Only it WASN'T a PNP transistor, it was a (bad) NPN transistor
I usually chuck these things aside to look at properly later/keep as references of odd failures. In most cases it becomes extremely obvious that these parts are faulty when I check them on my Tektronix 576 at healthy test voltages/currents, but yeah, often that's a last resort test after something has passed basic inspection but presents symptoms pointing to a bad device.