It's possible it's the heater then... When they start to die they can do so in odd ways. Usually they just overheat and fry, but it's possible it's shorting out internally and emitting some odd EM signals. Some fish can go a bit crazy from these, and since heaters are running mostly at night after the lights shut off it could be why you're only noticing the strange behavior during that time. Does the tank stay warm enough without the heater? If so you can try taking it out for a couple days and seeing how their behavior changes.