Had the same thing happen with a build last year, drove me nuts for a whole afternoon. Turned out the cable was fine but the connector on the board was worn out, so it would only lose contact when the case got warm and things shifted a bit. What finally worked was swapping to a cable with a locking clip and putting a tiny zip tie around it for extra hold. Six hours is rough but at least you got it, those tiny gremlins are the worst.