Tom Moores hit a quickfire fifty and Shaheen Shah Afridi took four wickets in an extraordinary first over before the Bears prevailed on a topsy-turvy night at Trent Bridge.