If i am not on 3G nor WiFi, do iMessage get sent via SMS? How does iMessage work? I had messaged one of my friend with iMessage, and he replied to me. However, I had disabled 3G and was not on a WiFi network. Were the subsequent replies routed via regular text message/SMS?
Yes, as long as the message was sent to your mobile phone number, and not your registered email address you will get a text message instead of an iMessage if you have no data connection when a message is sent.

iMessage is designed to seamlessly integrate with the messages application on your iPhone. Once set up and configured, your device will automatically decide whether to send an iMessage or a text message when you send a message to a contact on your phone.

Basically, when you compose a message and click send, your device checks with Apple to see if the recipient has iMessage enabled for their device. If they do, your iPhone will attempt to send your text to them via iMessage.

Your iPhone will then wait for a notification from apple that this message has been delivered. If this notification is received your message will have "Delivered" written under your message. 

However, if the message is not delivered after a few minutes your iPhone will delete the iMessage, and send your text as a regular text message instead.

In the case of your example, your friends device would have attempted to send an iMessage, then after getting no delivery notification, would have sent you a text message instead.

You can ensure that an iMessage is always sent by composing your message to your friends iMessage registered email address instead of their phone number. 

You can also set the "Caller ID", that your phone sends when it sends an iMessage, to your email address instead of your phone number in the Settings application. This will mean that your friend replies back to your email address instead of your phone number ensuring that only an iMessage is sent, as email addresses cannot receive regular text messages.