Опитвали ли сте просто да добавите условие where вътре в подзаявката?
SELECT a.name , a.partnumber , a.supplier , a.cost FROM table1 a JOIN ( SELECT name , partnumber , MIN(cost) cost FROM table1 where stock > 0 GROUP BY name , partnumber ) b ON a.name = b.name AND a.cost = b.cost AND a.partnumber = b.partnumber