An example is apart of something, one of a number of things: "This is an example of his better work." The word also means "pattern," "model," or "specimen": "His devotion to work set an example for all of us." An instance is that kind of example used to prove or illustrate: "His bad behavior that day was an instance of his surly character." A sample is a small part of something and has the basic meaning of "specimen": "This sample of cloth is lovely." Although "for instance" and "for example" are interchangeable, instance and example are not: your behavior can set a good example for others but not a good instance.
Dictionary of problem words and expressions. Harry Shaw. 1975.