The social media company reports a net profit for the first time and returns to revenue growth.