There is production (and research) overflow, but it can be difficult to tell from the interface. Mouse over a blank spot in your production queue (planet or shipyard) and after a moment a tool-tip will show up telling you how much production is banked. Make sure it is a blank spot, not over something queued for construction - if your queue is full, it won't show up. The # of turns shown that are remaining will not accurately take the overflow into account, but actual production time will. In your example above, after the first factory is built you should have ~20 production banked, so the second factory will still show 2 turns, but will actually complete in one turn, leaving ~15 production banked for the third factory which should also end up taking 1 turn.
Same thing in shipyards (I've had several hundred points banked after a run of constructors - I then queue up a battleship that says it should take 6 turns, but it is finished on the very next turn if I have enough production banked).
Research is similar, except I don't know any way to actually see how much overflow you have accumulated. Nonetheless, the time required to research a new tech can be considerably less than the # of turns shown.