Thick as thieves
They are as thick as thieves. I know that means "very close to each other", "best friends" and maybe "partners in crime" (not literally). But I don't understand the literal meaning. What does the word "thick" mean here? It doesn't feel like "stupid", "portly", "hard" (even figuratively), or "compact"... But there must be a reason why "thick" thieves were supposed to be close friends. Or is it something like "thick" to each other? Could you please explain me the logic behind this idiom?