You should look into Morale rules, even if this means looking at morale rules for followers of previous editions (like AD&D). A large conscripted army of peasants is more likely to flee because of an ambush than a disciplined, small veteran force even if the veterans are outnumbered. These were in earlier editions partially handled by morale (Will) checks.
In a core D&D 3.5 campaign there are no morale rules. Creatures fight to the death, flee or surrender depending on the DM's decision only. Paizo has mass combat rules if you want to look at a recent (Pathfinder) edition.
You could also consider to just make your own morale rules once you look at the suggested other editions in case you don't like those. Consider the race, class, training, level, supplies (food, water, ect), how rested they are (was the enemy in forced march, maybe had to pass across mountains?) and ambush efficiency when you decide if enemies get routed or not. A goblin due to race is likely to have a negative number to morale check while an orc a positive one, an untrained or 'greenhorn' soldier is far more likely to flee than a soldier drilled with Prussian discipline, hungry soldiers will resent their leadership soon enough and be both weaker and more likely to flee. Assassinating the officers or message runners will likely cause chaos and drop morale (make the Will checks harder) as well.
As such if the players have to use ambush tactics do the usual routine as well: Cut off enemy supply, raid the supply routes, burn their food if capturing it is impossible. Do this before even attempting to fight the enemy force directly (or even to ambush it)
However, if you do implement these, remember the enemy is not likely to be stupid and is going to adjust to these tactics. It might first send large masses of newbie soldiers as a form of active duty experience gaining when they underestimate their tiny foe (player nation), but as time goes on they will send better officers, soldiers, supplies (also equipment), begin to protect the supply caravans with escorts, execute deserters and 'incompetent' leaders (however they decide which those are, might only be sent back home instead), start to be more aggressive towards simple locals (while first they tried to act as benevolent new rulers) and could even execute those they believe work against them or just to make an exemple of assumed spies. With paranoia growing among their ranks.
With only a small nation and force on the side of the players it is highly unlikely they can win a war. They just get outnumbered. The players will need either more allies, preferably other nations which dislike the common enemy empire (maybe allies inside that empire), or continue with ambush & raiding tactics and hope the enemy leaders will decide at a point in future that the little realm is not worth the effort and losses, thus they will offer peace terms which change little or nothing (status quo, or a tiny compensation for one side's or the other's losses) but even if peace terms are offered if the enemy still considers itself dominant it will instead offer terms that benefit their own side (like vassalage for the smaller realm, or monthly taxing for a number of years)