Well in that war if the North had overrun the south, then North Korea would be a much bigger threat. If it's in the interest of the US, then it's okay. But Iraq and Vietnam were not threats to our national security.
If we hadn't interventioned in the Korean war, North Korea would have taken over almost the entire peninsula. They also has Communist China and the USSR on their side, South Korea would have been screwed without help from the US.
But when you think about it, the Korean war was just short-term and all. Having North Korea control almost the whole Peninsula is long term suffering for all Koreans, and torture in concentration camps for many others.