I believe these missiles cost a crapload of money, are slow to make and Ukraine has a small number of these. It would be irrational for them to use not one but at least two of them (some sources say there even were 3 hits) without a decent chance of a hit.
1. UK promises to ship anti-ship Harpoon missiles to Ukraine.
2. Ukraine was holding these Neptune missiles as the "ace in the hole" if the Odessa amphibious landing was ever to occur. After all, destroying enemy ships would kill most amphibious landing plans.
3. Since "Harpoons" are promised, Ukraine was suddenly in a position where it could use some weapons "recklessly", fishing to get lucky. As long as the UK's Harpoons arrive in time to defend Odessa in time, then the use of the Neptune missiles would be worth the tradeoff (even if there was a high chance of failure).
------
On the other hand, Ukraine built the Moskva (in the Mykolayiv Shipyard). The 1990s refit of the Moskva was also handed by the Mykoalyiv shipyard (IE: Ukrainians not only built the original ship, but also handled one of the upgrades). It is quite possible that Ukraine had deep knowledge about the capabilities of the Moskva, and this was "less luck" than any of us can see.
Us in the USA may have overestimated the capabilities of the Moskva, while the Ukrainians knew more details about how / when to attack it for maximum chance of effectiveness. What they needed was a plan to defend Odessa however once those missiles were used up. UK providing a "backfill" of Harpoon missiles was therefore all Ukraine needed to go with the "lets try to get lucky" plan.