'Thick' was first used to mean 'closely allied with' in the 18th century.
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.