Their Enterprise was probably not a troop carrier. Five thousand (or whatever) is probably the safe number of people the ship could carry when configured for planetary assault or infantry ops. And remember, it's those thousands PLUS their gear, reasonably comfortable barracks, briefing, training, maintenance, transportation, casualty, and muster facilities. Lots of stuff.
We've previously discussed that the Galaxy's evac limit of 15,000 is probably not based on the physical number of people they can sqeeeze into every nook and cranny of the ship. Rather, it's factored in with how many people the ship's systems can safely maintain for transit without overly taxing life support (including air, food, waste extraction, and so forth). The International Space Station orbiting over our heads has the volume of a passenger jet, but it's not designed to safely accomodate more than 13-14 people at a time (usally it's six). Same thing with starships, just scaled way up.
Mark
EDIT - Ahhh! Genius simulposts!