1 >> Download Flashtool and the official Gingerbread Rom for xperia ray from here:
Flashtool : http://androxyde.github.com/Flashtool/
Xperia Ray Ginger bread Rom (ST18i)_4.0.2.A.0.42_CE : 402A042_CE.ftf
2>> Install flashtool on the default directory.
3>> Install the Drivers for Xperia ray flashing, after installing flashtool you can find it on
C:/flashtool/drivers/
Double click on the Flashtool-drivers.exe and install the following drivers as shown in this pic below:
5>> After your ray is connected in flash mode just click on the flash icon, ( the big and first icon below file menu) on the flashtool window. Now check flashmode>OK and then browse to the folder where you have kept the gingerbread firmaware ftf file which you downloaded earlier.
6>> After selecting the "Xperia Ray (ST18i)_4.0.2.A.0.42_CE.ftf" file click on ok leaving the default options as they are flashtool will begin its process.
7 >> After flashtool finishes the flashing process you are done Downgrading to Gingerbread again.
Cheers mates, If you find any difficulties in this process feel free to comment and ask me your questions.