The causes of pinhole leaks are numerous and some of the most common causes are: water quality characteristics, pipe manufacture, pipe installation, ... and possibly stray currents. The actual causes are very difficult to pin down, and it is often a combination of the various reasons which lead to problems. The utility which I work for has been investigating pinhole leaks (causes and how to prevent) for the past 12 months, due to a high number of pinhole leaks in our distribution system.
I highly recommend you review the book entitled "Internal Corrosion of Water Distribution Systems" by AWWA Research Foundation, 1996; this is an EXCELLENT source of information whether your problem is copper, cast iron, ... This reference has photos of the various examples, history, causes, and preventive methods / recommendations. Check out the book - you won't regret it. Also, there are several paperback AWWA Research Foundation reports on more specialized topics.