What about if you put this in the init string of your createunit commands:
Currunits=Currunits+[This]
Will look something like this:
CurrUnits=[]
"soldierWB" createunit [ [_ax + (random 10),_ay + (random 10),_az],group Officer1,"CurrUnits=CurrUnits+[This]",0.5,"sergeant"]
"soldierWB" createunit [ [_ax + (random 10),_ay - (random 10),_az],group Officer1,"CurrUnits=CurrUnits+[This]",0.5,"corporal"]
I used a global array assuming the rule about not using local variables in a units init field still stands when creating units using a script. Plus it makes it easier to define and empty your array each time you want to create a new group.
Then call your delete vehicle script with Currunits:
{DeleteVehicle _x} ForEach Currunits
I hope to use createunits for the same purpose myself in the near future, so I'm interested in the solution to your problem.