Phase stabilization of a coherent fibre network by single-photon counting