I just ran into pretty much this situation, only it was a bit delayed--I got out of the Sanitarium fine when I did the main quest there (killed Azo and several wichts, spoke to the statue on the way out). When I went back in to speak to Nans about the Ondra's Gift sceptre I somehow missed her on the ground floor (and everyone was non-hostile at this point, I should add), so I went down to the basement and ran into a couple of hostile Flesh Constructs, which I dispatched. When I went back upstairs, everyone was hostile and I had to kill the guard next to the stairwell and sneak past everyone else to get out.