  We consider the relation between three physical problems: 2D directed lattice
random walks, ensembles of $T_{n,n+1}$ torus knots, and instanton ensembles in
5D SQED with one compact dimension in $\Omega$ background and with 5D
Chern-Simons term at the level one. All these ensembles exhibit the critical
behavior typical for the "area+length+corners" statistics of grand ensembles of
2D directed paths. Using the combinatorial description, we obtain an explicit
expression of the generating function for $q$-Narayana numbers which amounts to
the new critical behavior in the ensemble of $T_{n,n+1}$ torus knots and in the
ensemble of instantons in 5D SQED. Depending on the number of the nontrivial
fugacities, we get either the critical point, or cascade of critical lines and
critical surfaces. In the 5D gauge theory the phase transition is of the 3rd
order, while in the ensemble of paths and ensemble of knots it is typically of
the 1st order. We also discuss the relation with the integrable models.
