The nitrate level may have been just one issue why the rams died so quickly but the other fish, the ram probably brought something in with it that has infected your other fish which is why they are dying so rapidly after doing so well for so long. There are many more diseases besides parasites that kill fish so just because you can't see them on the outside does not mean they aren't on the inside.
This is just another example of why it is ssooooooooo important to qt all new fish no matter where they come from for a period of time ( not just a week or 2) to make sure they don't bring anything with them into your tank.
As for your well water having such high nitrates, you may want to use some type of nitrate absorbing filter/ material on your water prior to adding it to the aquarium. Depending on what type you use, this can be done by holding water in a plastic garbage pail and running a HOB on it with the material or adding it to an inside corner filter until the nitrate level is down to 0 and safer to use. Just because it comes out of the tap that way does not mean you have to use it that way. All water can be altered if you want to do it.
In your case, at 40PPM, I would highly suggest it as that level is a bit of a stress on a lot of fish types.
Another option is to do some live plants that are know nitrate absorbers. Do more frequent smaller water changes so that the plants have a chance to absorb the new amount of nitrate being added. This is a more costly and slower method than filtering however but it does give you more options.