Sure, it looks like a bad move, but if white's queen remains on the 7th rank, white's a promotion away from a (maximum) two move checkmate. The only other moves for black that make a little more since are 3...Qh6 and 3...Qf5, but those both lose to 4. d8=Q+