You can do a bunch of stuff in a 40g, I have 48g and it's doing pretty good. Khulies would be fine :)
Most heaters are good, as long as it's adjustable and it should say on the package how many gallons it's range is. the top fin heater are pretty good and have rubber on them to protect it from shattering, I think they also have a lifetime warranty. for a 40g it would be $31.99. The Fluval Submersible Glass Aquarium Heaters is also a great heater and is on sale(on the petsmart web site) for 29.59 (normally 36.99)
I have 5 female bettas, 2 scissor tail rasboras, 1 blue(two spot) gourami, a school of red eye tetras, a bristle nose pleco, and a gold mystery snail, and a African butterfly fish. I can only keep one gourami in this tank because he will attack any other. I bought him when he was small like a year and a half ago so he's grown up with female bettas and leaves them alone.
One fish that didn't work out at all was a paradise fish, he attack my girls and killed a few of them in only a few hours, he now lives in a 10g with my male betta(divided) and is the most aggressive fish I have. I also added a female betta that I rescued from wall mart(the fish in the net breeder) but she is highly aggressive and although she was fine the first day she attack a few of my girls the second day when I wasn't home and the two didn't survive their severe injuries. It's sometimes hit and miss, but you can make a great sorority and community tank with a tank that size. I was always pushing the boundaries of what I could keep int there. I've found that with larger gouramis it's best to buy them small and let them grow up with the bettas.
The more hiding spots you have the more fish you can have, mine is now pretty open so I don't keep it over stocked like I had with my 17g.