Hammer shouldn't let you do it. When you delete the last brush in an entity, it should also delete the entity, but sometimes a ghost is left behind. It sounds like you did the right thing which was to just delete the empty entity.

Additionally, the compilers should probably just ignore an empty entity anyways, but, well, this is what we have to deal with. Have fun!