AGF tog en vigtig 2-1-sejr mod et ellers velspillende Viborg-mandskab og er nu syv point foran FC Midtjylland.