This now happened to me twice, which have had me loose lots of in-game hours. I'll break it up in short description:
1. Both of the times I unlocked the door, and stealthed as I was stealing, and without being caught stole some books, and stole the scroll needed for The Theorems for Pandgram.
2. The first time I got so far in the quest that I got the scroll, and buried it. Upon my return I got attacked as soon as I entered the building. AND ofcourse, I had not saved for the last 3-4 hours, so it was a long backtracking.
3. Second time I did a few other quests, and thought I had forgotten to ask where to find the thieves, so I went back inside... and again, I got attacked. Reloaded from a save from just 10-20 min earlier and snuck in - none attacked. Reloaded, and walked in - got attacked. 4. Either there is a bug where you can sneak in to reset the aggro, or the bug is that they somehow realized you've stolen from them - despite not seeing you done it. And I've stolen A **** LOAD of stuffs before, without being spotted, and no consequence... so how the heck is it that this lot knows? 5. So solution for me: Sneak in! (DO NOT want to reload and backtrack another couple of hours)