How Yahoo escaped its Verizon death spiral and became profitable again.