I have a Canon lens (ultrasonic 17-85mm) and the biggest of the contacts is scratched slighty. It is now showing a connection error. It works only from time to time. Is there a way to polish the scratch out?
You could smooth the scratch out, but that probably wouldn't help the connection between the lens and the camera. In fact, it would most likely make it worse. That is because any additional material you remove is going to increase the gap between the contacts in the camera and the contacts in the lens.
The springs that maintain good contact between the lens and camera are located on the camera body side of the connection with Canon EF and EF-S mounts . The contacts of most well-used lenses show some degree of scratching from the sliding these contacts make with the spring-loaded contacts on the body when you twist a lens on or off the mounting flange.
The "biggest of the contacts", as you describe it, of an EF lens is designed to contact two of the spring loaded pins in the camera body. When viewing the camera looking into the mirror box with no lens mounted, the second and third pins from the left are both connected to the "P-GND", or ground, for the battery voltage supplied, via the first pin on the left, to the lens to move focus motors and other mechanical components in the lens. The "P-GND" is the only connection in the EF lens mount that contacts two pins on the body, possibly to let the camera know when the lens is seated properly. If both pins don't have good contact you will likely receive an error message from the camera. Power to the integrated circuits and contacts used for communication between the camera and body are carried via the fourth through eighth pins.
If you have other EF or EF-S lenses that do not demonstrate the same problem when mounted on your camera, you can probably rule out a broken spring in the body side contacts. If that is the case, your lens needs to have the contact assembly replaced. Unfortunately, with a lens such as the EF-S 17-85mm f/4-5.6 IS the repair will cost an appreciable amount of the cost of a new lens. You might be better off to buy another used copy or use this as an opportunity to upgrade to the EF-S 17-55mm f/2.8 IS, which is a much better lens.
It's possible your problem might not be originating with the scratched contact. I owned one of these lenses once, and mine developed a connection problem stemming from a ribbon cable inside the lens. It's used to communicate to the bits of the lens that move as the lens zooms, and as such, this ribbon works back & forth every time the lens zooms. Mine eventually broke, though you couldn't tell just looking at it. If your lens only shows the connection problem when you're zoomed all the way in or all the way out, that could very possibly be your problem, as well. If this is the case, it won't get better -- you'll need to have the lens repaired or replaced.
The good news is that a replacement ribbon is available on ebay for about five bucks. The bad news is that in order to replace it, you'll need to disassemble the lens almost entirely. I believe that when I was done, there were about three screws still remaining untouched. It's tedious, but very doable if you're careful.