I've been using the Docuware API and Filecabinet Searches in Workflows for similar features. I'm thinking if you want to get all the DWDOCIDs for the documents, you could assign the DOCIDs to a keyword field to make a list, from a FileCabinet, select the DOCID, then the where statement would be something like (DMS < '4') and this returns all the DOCIDS less than a DMS of 4.
Then send the Keyword variable through a loop to delete each document.
The other option is similar but using the API to search the different values. A little to involved to explain here. but the API documentation has been expanded for 7.10. (This option only exists for DW 7.9 and above)