Oh I don't think he was unstable or anything, he did that (I believe) knowing full well what the results and potential consequences would be.
Results: Stocks jump upwards, hopefully enough to hurt the short sellers and make them back off. The short sellers have / had been paying heavily to portray Tesla negatively in the news, just look at the coverage that one accident with a Tesla on autopilot through a construction zone had, or the coverage Tesla gets when there's a fire (while a thousand gas powered cars go up in flames during the media outburst).
Potential consequences: SEC on his ass. I don't think it'll end well for him. If he's lucky he just gets a big fine and gets to keep helming Tesla and SpaceX. This settlement was probably the best deal for him (financially) and only a fraction of the money gained / lost on the stock market from his tweet. But it would mean he had to step down for two years - possibly the two most critical years in Tesla's history.
IMO he shouldn't have published that, that was a bad call.