Has any country won a war, but lost a non-trivial amount of its territory? For example, 10% or 20%. It doesn't matter whether this country still exists or not.
Some examples from WW2:
Poland was on the winning side but lost the eastern half of the country to the USSR. Yes they got compensated by German territories, but we could have some fun debating the relevance of that.
Britain came out a winner but it's impoverishment was a significant factor leading to withdrawal from the Empire.
I have read your question as "Has a country ever won a war, and still "lost" territory, and if so, why?"
One example was the Austro-Sardinian War, otherwise known as the Second War of Italian Independence.
Sardinia (Piedmont) won the war. She did so with the help of France, under Napoleon III. She had to cede her holdings of Savoy and Nice to France to obtain this help, (thereby "losing" territory to France). She was "compensated" by getting Lombardy from Austria in a winning war. Shortly thereafter, Piedmont's enhanced military and diplomatic stature enabled her to annex other parts of northern and central Italy, and ultimately unite all of Italy under her rule.
Such scenario is not uncommon during the decolonization-related wars of the 20th century. The colonial power is often able to defeat the other side militarily, but for political or other reasons had to withdraw. Some examples:
- Indonesian National Revolution (1945-1949), was considered to be a Dutch military victory, since Dutch military forces were able to defeat the Indonesian republicans and maintain control of Indonesia's major towns, cities and industrial assets. However, diplomatic pressure as well as the continuing guerrilla warfare forced it to accept the independence of Indonesia, formerly its colony since the 17th century.
- Suez Crisis (1956). Egypt nationalized/seized the Suez Canal (which was previously held by the British) in 1956. Britain, France and Israel subsequently attacked and defeated Egypt, but political pressure forced them to withdraw and accept Egypt's control of the canal.
Despite being outnumbered and outgunned Finland managed to repel a Soviet invasion in the Winter War of 1939-40 although they lost 11% of their land area.
War between Chile and the coalition of Peru and Bolivia During this war, Chile payed with territory (Patagonia territories) to Argentina in order to prevent Argentinian intervention in the war against Chile. Thanks to this deal, Chile won the war and several territories from Peru and Bolivia. But Chile lost any demand over territories on the Patagonia east of Los Andes mountains, territories twice the size of Germany.