A Close Shave is the 40th episode of Thomas and Friends.
After recently being framed by Devious Diesel for telling jokes about the engines to the Troublesome Trucks, Duck sadly goes to Wellsworth where he meets Edward and tells him what happened. Edward assures Duck that the Fat Controller will find out what is really going on and asks him to help out with the trucks for the day.
Duck feels happy as he and Edward set to work with a goods train. Edward pulls the train while Duck pushes bunker-first from behind. However, the trucks are in a bad mood and make work hard for both of them. When they get to the top of Gordon’s Hill, Duck bids farewell to Edward and heads back to the station. But as he coasts down the hill, enjoying the breeze, he suddenly hears the whistle of a guard who was knocked out of his brake van because Edward's trucks have broken away and are intent on chasing Duck down the hill and derailing him.
Duck makes a run for it, but the trucks quickly start to catch up. Luckily for Duck, the trucks only catch him gradually and do not throw him off the rails, but nevertheless Duck is forced to keep going at top speed as the trucks push him. Just as they are starting to regain control, Duck and his driver spot James pulling out of the station ahead on their line with a train full of passengers. Duck tries his hardest to stop the trucks, knowing that a terrible accident could result otherwise, but is unable to slow down. Duck shuts his eyes and braces for the crash and is about to run into the coaches when he is diverted into a siding at the last second.
At the end of the siding is a small shop where a barber has set up his business. Duck barrels down the line and crashes right into the front of the shop, completely destroying the wall. The trucks pay no attention to the damage; they are rather pleased with themselves. As Duck peeks in through the debris, he apologises to the barber, but the barber is furious and coats Duck's face with shaving cream as revenge for frightening his customers.
Thomas and Percy arrive to help clear the mess, while the Fat Controller speaks with the barber and explains that while he understands how upset the barber is, Duck and his crew helped to prevent a serious accident, and it was "a close shave" that nobody was hurt. The barber apologises for his mistake, rinses the shaving cream off, and compliments Duck for his bravery, and so does the Fat Controller who tells Duck how proud he is of him.
Soon Duck is pulled out from the barber shop by Thomas, and the Fat Controller tells him he will be returning home once he is properly washed and repaired. Duck becomes worried, believing that the engines still hate him and prefer Diesel. The Fat Controller tells Duck that is no longer the case, as he never believed Diesel and has sent him packing. The other engines are now all very sorry and want Duck to come back.
A few days later, after being mended, Duck returns to the shed where the other engines welcome him back with happy whistles. Proudly taking his place alongside them, Duck feels happier than ever to be home with his friends.