Wainwright wins 1st, Cardinals beat Pirates 10-7