As thick as thieves
Close friends with; sharing confidences.
We might expect 'as thick as thieves' to be a variant of the other commonly used 'thick' simile 'as thick as two short planks'. The fact that the former expression originated as 'as thick as two thieves' gives more weight to that expectation. As you may have guessed from that lead in, the two phrases are entirely unconnected. The short planks are thick in the 'stupid' sense of the word, whereas thieves aren't especially stupid but are conspiratorial and that's the meaning of ' thick' in 'as thick as thieves'.
'Thick' was first used to mean 'closely allied with' in the 18th century, as in this example from Richard Twining's memoir Selected Papers of the Twining Family, 1781:
Mr. Pacchicrotti was at Spa. He and I were quite 'thick.' We rode together frequently. He drank tea with me.
Like all 'as X as Y' similes, 'as thick as thieves' depends on Y (thieves) being thought of as archetypally X (thick). The thieves had some competition. Earlier versions were 'as thick as'... 'inkle weavers', 'peas in a shell' and 'three in a bed', all of which were examples of things that were especially intimate (inkle-weavers sat at looms that were close together). These variants have now pretty much disappeared, leaving the way clear for 'as thick as thieves'.
The association of thieves with conspiratorial and secretive language was well established in England in the 18th century. Many of those on the fringes of society, for example poachers, homosexuals, street hawkers and thieves, used secret words and phrases to converse furtively amongst themselves. Backslang was one example of this, the best known survival of backslang being 'yob' for 'boy'. Several lexicographers had published dictionaries used by those on the wrong side of the law, notably the New Dictionary of the Terms Ancient and Modern of the Canting Crew, 1698. The 'canting crew' were the various vagabonds and coney-catchers (conmen) that inhabited the streets of British cities. The dictionary explained how to decipher the language of "the tribes of gypsies, beggars, thieves, cheats etc.", so that people could "secure their money and preserve their lives".
Given that thieves were established as being 'thick' by the late 17th century it is surprising that 'as thick as thieves' didn't emerge until a century or so later. The records of the Old Bailey, which list transcripts of cases held there since 1674 and which might be just the place to find this phrase, don't list it until 1874. The first example that I can find of it in print is from the English newspaper The Morning Chronicle, in a letter dated March 1827, published in February 1828:
Bill Morris and me are as thick as two thieves.
So there you have it; proverbially at least, planks are stupid but thieves (unless you include bankers) aren't.
See other 'as x as y similes'.