This is because Edie was frightened, angry and confused with Tom/Joey and the whole situation. She hates the fact that he lied to her about who he really was. However, she still loves him for the person he had become since he met her. The beginning of the film, especially the first sex scene, shows they are clearly still in love and still very attracted to each other. So while she is frightened and confused, she still lusts for Tom. Also, violence can turn some people on. And the bad boy, Joey, certainly turns her on.
Another, more symbolic interpretation could be that the sex scenes represent Tom and Joey respectively. The first scene is full of love and happiness while the second is confusing, violent, and real. The first sex scene involves roleplay and a fake reality for both Tom and Edie, and this represents their relationship as a whole - it's fun, full of love, but above all, fake. The second sex scene takes place on a staircase (hardly comfortable, as we can later deduce from Edie's bruises on her back) and is nowhere near as lovingly passionate as the first one.