Just a guess: Is this a rim lock (with the body of the lock mounted to the surface of the door rather than installed into a space within the door)?
If so: Some rim locks try to protect themselves against certain kinds of brute-force tampering by incorporating a spring-loaded metal plate which drops into place and latches there, preventing access to the lock mechanism. If this was being released inappropriately, it could be interfering with the tailpiece. (I'd be slightly surprised if it caused a lockout, but stranger things have happened.)
Fixing this _can_ be as simple as tightening a few screws, so if that's what's going on it may be premature to assume it will happen again.
As others have noted, if it happens again the easiest solution is to go in another way, dismount the lock from inside, and get it fixed properly (if you carry it to the locksmith he won't hit you with a trip charge) or replace it with a new one.