Oh, oh, oh, this is “harcore” VirtueMart Core Files hacking what you wish to do. For this you must at least know a good portion of MySQL and PHP as what you require can only be done with insering complete new queries into the core files of VirtueMart.
When now only one routine is called, to display the numbers until out of stock you will have to split this code into 2 codes, one new one that calls the products availibility until the stock reaches 5 and displays a yes instead of the quantity in stock and one other new one that is called and calls the actual availibility of the stock when the desired amount is reached.
You CAN achieve this with hacking and modifying the core files but you must be a PRO to do so. Everything is possible with VM but one needs the knowledge to do so….;)
When this is a seriously needed modification then I suggest to order a freelancer.
HAPPY NEW YEAR!!!