Ordering a set of unorganized points along a curve
You have an instance of a problem called curve reconstruction from unorganized points. Now that you know what to search for you'll find several methods, such as the crust, NN-crust, etc. Here are a few links:


The Crust Curve Reconstruction Applet
Curve Reconstruction by Tamal Dey
Curve and Surface Reconstruction: Algorithms with Mathematical Analysis, book by Tamal K. Dey, Cambridge University Press, 2006


Since you're dealing with curves and the samples are dense, I suggest you compute an Euclidean minimal spanning tree.