途端に... => as soon as; just as ~ N2
Time
~ひょうしに(~拍子に)   => the moment [A], unintentionally / inadvertently caused something to happen N1