In a surprise after several quarters of disappointing results, Twitter reports better-than-expected earnings and revenue.