Throwing myself into this discussion....
"Sex" refers to biology, whereas "gender" refers to society and culture. As in, "the effectiveness of the medication appears to depend on the sex of the patient" verses "peasant societies, gender roles are likely to be more clearly defined". (Examples taken from Dictionary.com.)
"Gender" also, I think, refers to what sex the person considers him/herself to be. For example, a male to female transexual would be male biologically, and so his (her?) sex would be male, but mentally he would be female, so his gender would be female. If that makes sense.
Miranda