In the Appearance Panel, click-drag the stroke **below** the `Contents` item will move the stroke behind the objects. Then use Object > Expand Appearance, then Object > Expand - check ONLY the Stroke option and hit OK. You are then left with a shape rather than a stroke. This is expected. You can then apply a gradient fill tot eh resulting shape. Illustrator CS5 has no option to create gradients on strokes. Here's a better method