I solved the problem using this query. I'm not sure how it will perform yet, so I'll have to let you all know later.
Select Item, Date, Time, NewCost, OldCost
From #CostHist a
Left Join #CostHist b
on a.item = b.item and a.date = b.date and a.time = b.time and a.newcost = b.oldcost
Where a.Item = 1
and a.date <=9950
and a.time <=750
and b.date is null