Technical glitches in Twitter Inc.’s advertising software roiled the social-media company in the third quarter, as a pullback in spending from some buyers and weaker pricing for ads also cut into revenue and profit even though it added millions of new users.

The disclosures and a tepid outlook for the current quarter surprised Wall Street, shaving off a fifth of Twitter’s stock-market value Thursday, and prompted questions about the engine that has helped sustain the company’s growth. Twitter, similar to other social-media...