There are several possibilities which could make this possible. The earliest possible time would be during (Go)joseon or Goguryeo, when the former could have unified resistance against Han China more effectively or the latter could have unified Korea at around 400-500, but that’s another story.
The earliest time during the last 500 years would be during the Imjin War. Because the aristocrats had firm control over the country, the king ignored Yi I, a Joseon scholar who planned out several armies scattered around the country to repel a possible Japanese invasion. The Imjin War occurred only eight years after his death, but if armed forces totaling about 100,000-250,000 had been trained and set up, then the Japanese, who invaded with about the same amount, would have been quickly repelled. This is not even considering the Joseon navy, which had been developed ever since they attacked Tsushima during King Sejong in response to pirate raids. Korea certainly had the advantage of geography during this war, and various land and sea generals, including Yi Sun-sin, certainly used this to their advantage. For example, Yi repelled 333 ships in the battle of Myeongyang with only 13 by utilizing currents in the area.
One possibility, in line with the above, that would cause further issues for Japan, would be Joseon and possibly Ming China invading Japan in retaliation for previous attacks. However, this would be extremely unlikely, and would require a severe drain in resources for all countries involved. This would most likely lead to a Japanese victory, but in either case, if Japan loses the war within 1-3 years, then the country would be thrown into chaos, possibly resulting in instability and division once more. Further butterflies would render Japan too fragmented to rebuild effectively, resulting in increasing influence first by Joseon and Ming/Qing, then possibly the Western powers in the 18th-19th centuries.
Another possibility, which could occur either with or without the previous POD, would be Joseon paying more attention to its military before the Qing conquers China. It could either take control of most of Manchuria before the Ming encounters the Manchus, or do so during the struggle between the two countries by coming to the Ming’s aid. Either way, Joseon would then gain land and some natural resources, leading to an increase in population and a strengthening of the central government. This would most likely happen if Gwanghaegun was not deposed as in OTL and instead reformed the military, which was already going into decline after the Imjin War. Although there are critical viewpoints of him, he was very capable, and encouraged the arts, while pursuing diplomatic affairs with the Ming, Manchus, and Japan. Although his forces lost to the Manchus, this could have led him to strengthen his troops and eventually emerge as the victor. The Ming would not have been concerned about Joseon’s expansion because it was more focused on weakening or defeating the Manchus instead of expanding territory.
The third possibility would be more aggressive Western intervention in Joseon affairs in the 18th-19th centuries. As stated before in other responses, traders could land in Jeju Island in order to demand trade. If the military is not developed, which is extremely likely after dismissing the previous options, the government would have no choice but to sign unequal treaties with the Europeans. Of course, it would be highly unlikely for Korea to undergo a “Meiji” of sorts, considering that the power was still in the hands of the aristocracy until Heungseon Daewongun in 1863. As a result, it would be absolutely imperative for foreign intervention before 1860 so the country would be able to look at policies ranging from military to cultural and political reforms. At the very least, Korea would be able to cut off tributary relations with the Qing and start embarking on technological reforms, while at the most, Korea could send people to Western countries like Japan did in OTL in order to learn more about their customs. In any case, this would completely change East Asian affairs in possibly World War I and definitely World War II.
On the other hand, if Korea does manage to retain a significant army in the 18th century due to either or both of the options concerning Japan and the Ming/Qing, then technological reforms probably will not occur until the late 1890s, similar to OTL, and other changes would take place much more slowly. However, this also might lead to more attempts from the West, which would have unpredictable consequences that would depend on the political atmosphere at the time.
The last possibility, which might be too late for Joseon, would be for either Heungseon Daewongun or the royal family (Emperor Gojong/Empress Myeongseong) to side definitively with Japan, China, or Russia. The latter would most likely be an unacceptable option because it might eventually lead to Korea’s absorption into the Russian Empire, and later population deportations, eliminating Korea as a country. It is absolutely necessary that Korea does not play the powers off against each other, because that occurred in OTL, and would ultimately lead to becoming a colony in any form. However, an alternative option would be paying closer attention to the Western powers, as in the third possibility. Ultimately, Joseon would probably become the Korean Empire in 1970-1990 in order to signify a change of relations with China, but because the political factions frequently conflicted with each other and there was no dominant position, it would be extremely hard for Korea to escape colonization if the situation diverged from OTL after 1960.
Now I’m really tempted to do all of these timelines . . .
Edit: I realized that my timeline already incorporates most of these possibilities.