In a saucepan, combine sugar, flour, and salt. Gradually add milk, stirring until smooth. Cook over medium heat, stirring constantly, until mixture thickens and boils. Boil for 1 minute.
Remove from heat. Stir a small amount of hot mixture into egg yolks; return all to the pan, stirring constantly. Bring to a gentle boil; cook and stir for 2 minutes. Remove from heat. Add coconut and vanilla; stir until smooth. Pour into pie crust.
Cool to room temperature. Refrigerate for at least 4 hours or overnight.
Before serving, top with whipped cream and sprinkle with toasted coconut flakes.