PosgreSQL: setting high work_mem does not avoid disk merge
This is somewhat speculative but Depesz (Hubert Lubaczewski) has this to say on the subject:


  You might wonder, though, why PostgreSQL switched to Disk, when it
  used only 448kB? After all, work_mem is 1MB. Answer is pretty simple –
  as I understand – disk is used when work_mem is not enough, so it
  means it's already been filled. So, sort with “Disk: 448kB" would mean
  that more or less whole work_mem has been used plus 448kB of disk.


So in your case the used work_mem might be in the 6 MB range. Also, try reset work_mem first, maybe there's stuff in there from a previous query.