Okay, the cleric got away. Good. Focus on what happens next.
The cleric ought to do a sending to the dragonmaster, letting her know how nasty the PCs are. All surviving kobolds will retreat to somewhere safe and innocuous, until reinforcements show up.
Next time, the big bad guy will be under the effect of a
freedom of movement spell or scroll. This would've made a big difference in the fight.
One trick for spellcasters is to blend in with the crowd: carry a martial weapon in one hand, wear drab clothes, have your compatriots wear drab clothes too, and have your compatriots shout mystical-sounding mumbo-jumbo in the middle of battle. Make it very difficult for the PCs to figure out who's actually casting the nasty spells at them. I did this in a recent climactic battle to great effect: the PCs wasted a couple rounds desperately trying to find the source of the nasty magic before seeing that one specific archer was never using her bow.
When reinforcements show up, consider doing a nighttime attack. Too many nocturnal ambushes can be very annoying for the players, but one or two can keep them on their toes. Do the PCs have horses? Target the horses in the ambush. Followers, cohorts? Try to take them out. Otherwise, consider making the nocturnal assault a theft-assault: archers fire from only one side of the camp, drawing the PCs out into the woods, at which point the thieves creep in from the other side and make off with all kinds of yummy loot (spellbooks, heavy armor, backup weaponry, backpacks, bags of holding, etc. -- anything that someone isn't going to wear to bed).
Daniel