AF speed between the two is not going to make a difference. But FYI, according to imaging-resource.com testing, the K-x is faster. The high ISO image quality is probably about par also.
A drawback of the K-x is that it does not display which AF points are active.
A drawback of the D3100 is that it does not have an in-body focus drive, so lenses without their own focus motor (such as Nikon's very good prime lenses such as the 50mm and 85mm) won't auto-focus.
Either way, lenses for indoor sports, i.e. wide aperture lenses, are expensive. Depending on how far away you are from the action, the lens could be (much) more expensive than the body. Moving up to the D5100 would not be any better for basketball.
My budget allows for Pentax K-x or Nikon d3100 or... (your suggestion?)

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic