Take it apart...
First, look at the contacts in the connectors at the cable ends and their ports and see if they are straight, clean, not in contact with each other, etc. You can use a toothpick as a probe and tool. Connect the cable and see if this has helped, bending the cable near the connectors to find any break in the cable or looseness in the connection.
On the condition that there is no sign of this being a problem with the HDD itself, and you have not found that there is any difference in the connection problem using your cable nor connecting the HDD with another cable, I assume that the trouble is the enclosure.
If your extern HDD is a USB box containing a standard HDD, you should be able to open it. You can try to see if there is something loose that you can tighten or solder, but your best solution may be to buy a new HDD enclosure and switch the HDD over to it.
Installing the HDD is very simple, just remember to get the same HDD interface (PATA/SATA) and the correct connection interface for your system (USB/Firewire/etc.).
http://www.newegg.com/Store/SubCateg...nal-Enclosures