From what Ive read, and please correct me if anybody knows this too be wrong, but the minerals (electrolytes) measured in hardness are used by the bacteria that break down ammonia and nitrates. If it gets low, the bacteria wont be able to break down these toxins in your water as effectively, so your pH may start to rise and you may even see some ammonia.
Long story short, if your pH is stable and your ammonia is 0, youre fine. If your pH starts to shift, then I'd look into your water hardness level. But I agree that nitrates around 40 arent too bad. My tap water is high in nitrates so mine can get a bit higher than 40 before a water change but it doesnt seem to stress my fish out.