Using Terminal to order SSID preference in System Preferences
A couple of things to consider:


Supposedly, specifying 0 for the index puts it at the front of the list.
You need at least admin privilege and may need root privilege. Have you tried it with:
sudo networksetup -addpreferredwirelessnetworkatindex ...?
If the wireless network is already a preferred network, you may need to remove it first before adding it again. That is, it may be ignoring the index if the network already has an index. Assuming your wireless port is en1, you can get the list of preferred networks with:
networksetup -listpreferredwirelessnetworks en1. I admit that I'm just guessing here.
If you have multiple wireless ports, it will of course make a difference which one you add this service to. You can list all your hardwareports, wireless and otherwise, with: 
networksetup -listnetworkserviceorder