If there is a 100 km/h headwind, you can't hurry by that much. That will exceed the plane's capability. Likewise for a tailwind, that would be too slow for the plane to stay aloft.
So, the increase and decrease of speed in head- and tailwind does not nullify the wind. The 14-hour flight was the one in tailwind. Think of the wind as a fast wave, with the plane riding it, the faster the tailwind, the faster the plane gets there.
The keyword is air distance. Wind increases (headwind) or decreases (tailwind) the air distance flown. And therefore the 3-hour shorter flight, would have saved 3 hours worth of fuel, roughly.
From Wikipedia, the Dreamliner cruises at 903 km/h. Using the total time in the air, you can arrive at a rough estimate of how long the air distance was.
From the table here 'For a B787 in cruise, what is the altitude, speed, and angle of attack?', we are looking at roughly 15 tonnes of fuel saved on the 14-hour flight.
The distance between SIN and SFO is 7340 in nautical miles, always use the same units. The plane's range you found is for a typical payload, if there are fewer passengers, the plane flies for longer, as it is lighter in payload and can carry more fuel. And with the wind accounted for, the actual air distance is then known.
See these posts: