Doc Brown has time to connect the cable with the ground wire after the lightning strikes. The lightning zips down the cable and Doc makes the connection just in time, but he clearly makes the connection after the lightning strikes. Correct me if my science is wrong, but the lightning wouldn't have traveled down the ungrounded cable, and certainly not at such a slow pace.
On a side note, wouldn't the cable act as a lightning rod and prevented the clock from being damaged by the lightning? Again, I may be mistaken and would appreciate any corrections.