This exact same thing happened to me one one of the AUS-DAL mileage runs on the ERJ. I went to the restroom and when I tried to get out, the door was jammed. I was able to get the lock unlocked, but the door wouldn't slide open. I could see about 2 centimeters through the door and rang the bell.
The FA came back there and died laughing saying she had gotten stuck earlier in the same lav while nobody else was on the plane. We both started pulling from each side of the door and finally the door ripped open.
I walked out laughing and told everybody else on the plane they better just hold it or else get comfortable with the rest of us and leave the door open.
What's funny, I also thought about how uncomfortable it would have been if I was clostrophobic. Luckly for us, we aren't!