The bug – and it is indeed a bug, I would classify it as a design but on the part of GS developers – stems from the fact that internally, in GS, datetimes are kept as numbers, and what's more, as floating-point numbers. The integer part represents the number of days since Jan 1, 1970 while the fractional parts represents the fraction of the day and is converted to seconds.
As any developer knows (but perhaps spreadsheet users should not be expected to know that, eh Googlers?) you cannot compare floating-point numbers using simple equality, because their representation may vary even if they look the same at approximation. It becomes clear when you view a mismatching date as a number, at big enough precision:
The way to do comparison on FP numbers is to see if the difference between them is less than the precision you are interested in - for sub-second precision, in this case the formula should look something like this:
= ABS(A5-D5) < 0.0000001