Investing is a long-term game that can build your wealth. Speculation is a short-term one, that quite often dents it.Sometimes though the temptation to indulge in the latter with a punt based on calculated risk proves too much for me.Which is how, last Friday, I found myself signed-up for the latest stock market craze and the owner of 14 SpaceX shares.Four days later, I’d sold the lot and cashed in for a quick £640 profit.I sold up despite suspecting that SpaceX has further to rise, so what was I thinking?As an antidote to the usual sensible investing advice I try to dish out on This is Money, here’s the brief story of how I threw caution to the wind – and how I actually learnt an investment lesson from it. The greatest showman: In true Elon Musk style, the SpaceX IPO was out of this worldSpaceX declared its intention for an initial public offering (IPO) in late May, the process by which a privately held company lists on the stock market. Alongside its filing to the US Securities and Exchange Commission came an eye-catching prospectus.It identified a $28.5trillion addressable market but that bamboozling big number wasn’t the most striking thing.For backing it up came details on its existing rocket launch, satellite and AI businesses, along with some bold future plans, including space tourism, passenger and cargo transport to the Moon and Mars, orbital data centres and asteroid mining.This was not your run-of-the-mill boring financial filing and nor was the expected price tag. SpaceX didn’t put a price in the prospectus, but it immediately became known that it was aiming for a $1.77trillion valuation – with $75billion raised by the IPO.That made it the largest stock market float in history and despite the numbers looking bonkers, over the following weeks it became clear that Musk was probably going to pull this off.From the get-go, Musk was keen to encourage ordinary investors, making as much as 30 per cent of shares available to them, rather than follow the well-trodden IPO path of locking them out and favouring institutions.On 5 June, we discovered even UK investors would get a rare opportunity to take part in a US IPO, and I started to think, ‘Hmm, this could be worth a punt’.The hype machine was in overdrive, and I could see a frenzy of interest was building from both institutional investors, aka investment banks, fund managers and hedge funds, and ordinary investors like you, me, or most importantly the great American public.Ever the showman, Musk was smart in throwing open the doors to what’s known in the trade as retail investors. Often, they are just left to pick up the scraps after shares started trading and an opening pop has rewarded the establishment.Welcoming ordinary investors to the party helped build interest and support – in an era of meme stocks, crypto, and vibes-based investing that matters.Musk was also clever in how he structured it. Raising $75billion entailed a colossal sum but it was a small enough proportion of the overall valuation to stoke the fires for demand to outweigh supply.I decided that I could see where this was going and reckoned the shares might jump 30 per cent or so in the days after the IPO.‘Why not roll the dice?’, I thought. ‘I’ll try to make a quick profit and get out. It would be good to see what it’s like to take part.’At this point, I did the first thing I need to do as a financial journalist and work out if I had a conflict of interest, due to having edited stories on SpaceX. But with a fixed price IPO, raising $75billion, largely from institutions and in the US, there’s no realistic way I could influence the price.So, I cooked up a plan to apply for £1,500 worth of SpaceX shares in the IPO, aim for a £500 profit and then cash out.If I could achieve that, I decided that I would treat the gain as fun money to pay for return flights for my wife and I to go away for a long weekend.To be crystal clear, this was a gamble and a very rough trading plan. It was not investing.I applied through my stocks and shares Isa and discovered last Friday morning that I’d got 14 SpaceX shares, which at the IPO price of $135 translated into £1,413 worth.Once trading opened it emerged that the pop was on for SpaceX. I checked my investment account far more times than is judged to be healthy on Friday and nearly hit the sell button a few times, as my paper profit nudged above £400.In the end, I held on and SpaceX shares closed the day up 19 per cent at $161. Over the weekend, I thought: ‘Why didn’t you just take the profit off the table and leave the rest invested?’On Monday, as the shares surged again, I sold three shares at $173 in mid-afternoon, banking £383, and then another one when I got off the train home at 7.12pm at $184, banking another £132.I’d done it, I had surpassed my profit target and made £515.And then came Tuesday. Yet again SpaceX shares surged – at one point reaching almost $220 - and yet again, I was constantly checking the price.I was in danger of turning a quick for-fun gamble into an investment that I was emotionally invested in. Realising this, I decided to sell it all.I cashed out my last ten SpaceX shares at $208, which translated into £1,535.That meant the SpaceX shares I bought for £1,413 were sold for a total of £2,050 – a 45 per cent overall gain.Why did I sell out completely? This was certainly a question I asked myself at the time, as I suspect despite their dip since then, SpaceX shares have further to rise.There’s plenty of buying pressure that will come through on the dips and more will come from index funds that start having to hold SpaceX to track the market, as it gets fast-tracked into a bunch of indices. SpaceX's satellite business Starlink is profitable, the rest of the company loses moneyBut ultimately, I don’t want to be a long-term SpaceX investor. I believe the $1.77trillion IPO valuation was based on a wild amount of hope value and when the market cap briefly surpassed Amazon’s this week it became even more mind-boggling.Musk is clearly a genius. The space and rocket launch bit of SpaceX has achieved exceptional things, but it still makes a loss and spends a lot of time sending its own satellites up. That satellite arm Starlink is a dominant and profitable business but tied into all this is the money-guzzling xAI arm, best known for taking Twitter downmarket and its Grok chatbot undressing people.Meanwhile, SpaceX’s early investors will be able to start selling in the months ahead at certain staging points and I imagine many will want to cash in some gains. Albeit while holding on to some stock.And technically, I am already one of them and already have a long-term investment in SpaceX, as I am a Scottish Mortgage Investment Trust shareholder.Nonetheless, as I sold up a lot of ‘what-ifs’ ran through my brain, triggering all kinds of FOMO instincts.Have I passed up the opportunity to make a fortune in the future, was being in on the IPO an early Nvidia or bitcoin moment that I’ll never get again, will SpaceX shares be even higher next week or next month?The intensity of those questions has dimmed, but they are still rattling around my brain.I’m ignoring them, hoping they go away, and accepting I’ve done what I set out to do. The lesson I've learnt? Keep investing and speculation separate and if you do indulge in a punt, resist the temptation to convince yourself it can become an investment just because it goes up. You're not a smart investor, you made a gamble and got lucky.My brief SpaceX adventure has made a total profit of £637 – tax-free thanks to being in my Isa – and it will pay for us to go away for the weekend.That was a far more modest aim than the asteroid mining or Mars colonisation but for me it’s mission accomplished.