Here is a video of me playing "Monk's Dream" with a guitar trio. Although there is lots of stuff that I wish I had done better in this video, I think that if you listen to the section where I am trading 8's with the guitar player (starting around 5:40) you will hear how I am trying to keep elements of the melody alive in my trading. This is one of the ideas that I have been working hard to incorporate into my playing, so I hope that it comes across. If you are having trouble hearing the melody, trying singing it along with the video.
While I am definitely trying bring out some of the elements and themes of the composed song, I am also trying to keep my ears open to what is happening in the improvised song that John and Dylan (guitar and bass) are playing as well. In other words, just because I am thinking about the original melody doesn't mean that I stop listening to what is happening. The trick is to find a balance where you can combine both songs as seamlessly as possible. For more on this, see the post "The two songs of jazz".
If you are looking to try to start working on this for yourself, Monk tunes are the best place to start. There is something about how he uses rhythm in his melodies that really sticks in your head and makes it easy to translate on the drums. Sorry about the somewhat low quality video, I think that the sound will still come across well enough.