This got too long for a comment.

Atiyah and Bott showed that the Yang-Mills functional on a Riemann surface is equivariantly perfect, i.e. it's perfect for gauge-equivariant (integral) cohomology.  To be a little more precise, they showed that a certain stratification (the Harder-Narasimhan stratification) of the space of connections is perfect in this sense, and Daskalopoulos showed (using Uhlenbeck compactness among other things) that this stratification does in fact agree with stable manifolds of the Yang-Mills functional.  (Atiyah-Bott had conjectured this, but did not prove it in their paper.  Note that Uhlenbeck's compactness theorem came just after Atiyah-Bott.)

For non-orientable surfaces, the situation is different: in some cases the YM functional is "anti-perfect" in a certain sense, and in some cases it's neither perfect for anti-perfect.  These ideas are discussed in recent work of Melissa Liu and Nan-Kuo Ho, and also in recent work of Tom Baird.