Are you using single capture focusing mode? (S)? (This is usually a physical switch on the camera, switching between S/C/A, in the case of the D5000 specifically it's an item on the Info screen). If you are using continuous focusing or auto, the camera will allow you to take a shot even if you do not have focus confirmation.
Also, if your VR is faulty, it can shake enough to create a blur.
To test focusing and lens fault (lenses can incorrectly focus sometimes):
Use a tripod. Set single capture focusing mode. Set Autofocus mode (A). Make sure you never mess with the focus ring in A mode!. Turn VR off. Reset to factory defaults. Go out on a sunny day, find a non-reflective thing, like a car, even better, a poster on a wall. Use 18 mm. Set P mode. Focus with the center spot, that is, aim with it, then press the shutter button halfway down, and you hear the lens focusing. When you get a focus lock, press the button down fully. Make 3-4 shots like this.
Do the same as (1) but with VR on.
Turn the focus mode on the lens to manual (M). Turn off VR. Now turn the focus ring to one extreme. Make a shot, then move the focus ring a bit, then make another shot. Make at least 10 shots, sweeping the range the focus ring can travel. (Always separate the focus ring movement from the shutter actuation.)
Do the same as (3), but turn VR on.
When you are done with this, you will have 3-4 photo from (1) and (2) each, and 10-10 photos from (3) and (4). Now go home, and fire up ViewNX. It can show the focus points the camera used for focusing.
Now, browse through your photos.
- If (1) and (2) is fine, you were just not focusing correctly.
- If (1) is fine but (2) is not, your VR is damaged.
- If (1) and (2) is both wrong, check the focus points in ViewNX. Are you focusing correctly? Is the are near the focus points sharp?
- Further, (3) and (4) shows how the in-focusness of the picture changes. Do you see changes in picture quality? Is there a particularly good one? If so, your focusing mechanics is okay (we do not know about the motor though). If you do not see changes, then your focus ring is not working, and maybe there is some damage in the lens.
- Also check the change turning VR on causes. You should have no big difference (since you took the pictures on a tripod :-) ), but if with VR is noisier, again, there is some trouble with the VR.
Good luck debugging. :-)