Just guessing that you might be trying to make this happen with everything inside the car. Well known fact that anything involving attaching "anything to anything" in that tight working space, at best, usually invokes the use of curse words .............. or at least lots of head scratching and wondering as to "how they did this at the factory. Since "it worked fine before I had the car painted" is your mantra, do yourself a favor and take the speedo (or the entire instrument panel) and the cable out of the car, go to your favorite work bench, have plenty of good light, and see if you can figure out what the issue is.
If you've beat me to the punch, try probing the inside of the speedo fitting hole with a safety pin or dentist probe to see if some form of debris found its way inside between "working fine", disassembly for paint, and reassembly now.
good luck