I have the SB-400... and, it's pretty awesome for just normal everyday, I need a flash that's more then what the on camera flash can provide.. I bought it with the diffuser and have already used it for a family of 3 during an outdoors portrait session and it gave me ALL the fill light I was looking for.. Just something to look into..
As far as Ai know the D5000 onboard flash does not support Commandr mode. If this is true I would suggest the SB800. Although it is more expensive than the SB400 and SB600 it will act as Commander while on camera to run addtional off cmaera flashes which you will likley grow into.
I would go for the sb-900! Why not? It is not THAT expensive nowadays, it's killer flash that can trigger sb-600's, sb-800's and any other future flashes, and the power you get with it is awesome, as well as the automate mode is very good. Or, a nicely used 800 if they're out of stock where you live. A bit cheaper, and still kicks @ss
editied to add: SB-900 and 600 may be a bit big on your camera. The 800 balances well. SB-800 was the first flash I got when I used D40, and that balanced pretty well. A 900, or 600 (which I think is bigger than the 800), may be a bit "big". I wouldn't go for the 600 because of the lack of "commander" or "master" mode. Of course, you could always buy a "better" flash later and trigger it, but... meh... nah, SB-800 if you find one!!!
The SB-900 is a beast, It is designed with the Professional in mind and it is built with the larger cameras in mind D3 in particular or D700 - D200 with Grip attached. It would be quite top heavy on a D-40 D-5000 or other body of that size. The SB-400 is more of a portable space saver, Nice little flash that fits in your pocket for those times when as said before your onboard flash can't cut the cheese. The SB-600 is a nice unit but lack of commander mode does draw it back a little bit. As for the SB-800. They are getting harder and harder to come by. I thought about buying one but have not seen one in any of the camera stores for a good year or two. Online might be the only place to find one. I have 2 SB-600's that I would like to join up with an 800. (So I have a nice portable system and can leave my Alien Bee's set up permantly). But as of the past month or so I have been starting to lean towards getting the 900 because I am starting to understand lighting much better now and am no longer affraid of the advanced features.
It really boils down to your own shooting, What are you going to use the flash for, how often are you going to use it, Will you someday be adding additional flash's to your set up etc... You can also check into 3rd party flash units as Kiwinick said and save a few coins. However Nikon's CLS is the cream of the crop and hard to match at any level until you start buying studio class lighting.
as big as you can afford. go for the 900 if you can swing it. and get a diffuser, like a lightsphere. you will always want more power. and with a diffuser it gets worse. plus the have more options and control. don't worry about the weight or balance. i shoot a XSI with a 580ex and a lightsphere and i don't have any trouble. plus if you upgrade your body at a later date, you will still have the big gun to go with it. and if you want to go smaller, you can get a 800 and use it to fire the 900 and really expand your strobe skills and success.
I would go for a used 800, but be carefull when buying used equipment! Find some marketplace and check it out. I bought my last lenses used, haven't had troubled with any of em'!
That said, I'm still in favor for the 900. You will love that flash. It is big, but a with a good grip it will balance well. you get thousands of benefits a 400 won't evenget close.