You can join the grouped select with the original table:
SELECT d.time, d.diag, d.unit_id
FROM(
SELECT unit_id, max(time) as max_time
FROM diagnostics.unit_diag_history
GROUP BY unit_id
) s JOIN diagnostics.unit_diag_history d
ON s.unit_id = d.unit_id AND s.max_time = d.time