OK, a step by step visual walkthrough. (give it a minute, imageshack is slow sometimes)
Step 1: create a new mailbox.
Step 2: I'm naming it "My Test"
Step 3: As you can see, the mailbox does not show up at all. Even if I quit and restart Mail, nothing.
Step 4: I create a second mailbox, called "Mailbox 2"
Step 5: Oh check it out.. now an arrow shows up, I click it, and there are both mailboxes.
Step 6: I delete "My Test" mailbox..
Step 7: All folders disappear once again
EDIT: Aha. Solution found.
Go to the account prefs, click Advanced.. checkmark "Automatically synchronize changed mailboxes". And for me personally, I had to put "INBOX" as the IMAP path prefix.
Works great now!