Unfortunately, some CO switches think they send the first ring but don't always end up doing so, or it is so short as to not register at the subs equipment. In theory, 2 rings should capture the CID burst. Using a Cisco SPA-3102 gateway set at 3 seconds (they don't count rings, just the time period after the end of the first ring), works just fine. So in your case, it may be to be an incomplete first ring cycle being sent, or detected. Having to set the gateway delay to 3 or 4 rings adds an excessive delay before the call is passed onto 3CX. There may be another setting in the gateway that would aid in detecting a partial first ring, something you might want to pursue if you can confirm that that is happening at times.
Since you use Comcast (a cable company), am I to assume that your PSTN lines come from an ATA supplied by them, then go into your gateway? If that is the case, you may want to see if they would allow you to go VoIP directly to them bypassing both devices.