Steven May scored both goals as Hamilton Academical were forced to come from behind before beating Dumbarton 2-1 at New Douglas Park.