IPhones can be unlocked safely, Apple has no way to 'mysteriously' get into your iPhone and either locked it again or renders its use. However, as a user you have to keep few things in mind. At the time of this writing, only iPhones with preloaded firmware 1.0.2 can be unlocked. Unlocking the iPhone with latest firmware 1.1.1 released by Apple is not possible.
So firstly, check your iPhone's firmware version by dialling *3001#12345#*. It will show a screen titled Field Test. At the bottom of the menu items you will see 'Versions'. Tap on 'versions' and another screen will pop up which will list the firmware installed on the phone. If it says 03.14.08_G, then your iPhone is version 1.0.2, your phone can be unlocked to use with networks other than AT&T.
If after tapping 'Versions', it shows 03.12.06_G, then your iPhone's firmware is version 1.0.0. In this case, you can change your iPhone to the version 1.0.2 first and then perform the unlock procedure. Press and hold 'Home' and 'Power' buttons simultaneously on the iPhone for 30 seconds until it shows "connect to iTunes message". Once in iTunes, hold "SHIFT" key & click restore button and choose file: "iPhone1, 1_1.0.2_1C28_Restore.ipsw". If you don't have the file, you can download the file from the website mentioned at the end of this article.
Finally, if after tapping 'versions' on your iPhone, if it says "04.01.13_G" (version 1.1.1), then your iPhone cannot be unlocked and you need to wait for an unlock procedure to be devised for that version. Many AT&T stores still have iPhone with firmware 1.0.0 or 1.0.2 in stock.
You may want to return the iPhone with firmware 1.1.1 to Apple, or your nearby store and get an iPhone with 1.0.2 firmware. How can you check the firmware version of iPhone without opening the sealed box? As no salesperson will let you open the box until you commit to purchase.
Once you have the iPhone box in hand, turn it over and look for a bar code named 'Serial No.'. A typical serial would look like 7U738L46WH5. Take a close look at the serial no. Somewhere in the middle there is the letter 'L'. Look carefully, if the serial no. has 8 or a lower digit preceding that L, then its fine. The firmware on this phone is 1.0.2 or less. If the digit preceding the L is 9, then the firmware is new.
Using this technique, once you are sure you purchased an iPhone with the older firmware, you can now unlock your iPhone using the unlocking software. At this time, iPhone cannot be unlocked by using a remote unlock code. You would need unlocking software to unlock your iPhone.
I found that the website UnlockSoftwares provides reliable iPhone unlocking software. The software offered at UnlockSoftwares is the exact same software I used to unlock my iPhone. The website UnlockAcell has an iPhone section, but I am not sure if they are offering iPhone unlocking by remote code.