Given the limited info you gave, I will try to help you.
If your iPhone is indeed 3G and you are sure you have Cydia on it (IT IS JAILBROKEN)
you need to confirm one more VERY IMPORTANT thing Go to Settings>General>About....scroll down to the very bottom and you will see
Modem Firmware: If the Modem firmware number is 05.11.07 or 04.26.08 or lower you are good to go, if it is something like 05.12.01 then not sure if you can do the following...
just google "ilikemyiphone custom restore 3.1.2" and the first result you get click on it and read everything carefully, follow the instructions for 3G iphone NOT 3Gs or 2G etc...Do you need to unlock your phone too? or just a Jailbreak? if there's also Unlocking involved make sure you read all the instructions for that too. If you are unclear on any one thing, come back here and let us know.
Hope I can be some help
Good Luck.