The Slingshot effect, also known as light-speed breakaway factor, is a method of time travel which involves flying around a gravity well at extreme velocities, the break away speed sending the ship backwards or forwards in time. A successful slingshot effect requires extremely precise calculations.
The first, known example of this method was an accident when the USS Enterprise - trying to break free from the gravity of the planet Psi 2000 - was sent three days back in time. Later the same ship was sent much farther back in time; when it was dragged into the gravity well of a black star. After that the Enterprise purposefully used the technique to conduct historical research in the 1960s. (TOS episodes: "The Naked Time", "Tomorrow is Yesterday" & "Assignment: Earth")
The technique was used again 2286 to travel back in time to obtain a pair of humpback whales to satisfy a probe, which was devastating 23rd century Earth, looking for the then-extinct species. (TOS movie: Star Trek IV: The Voyage Home)
The slingshot effect was used in 2364 when the USS Enterprise-D was caught in a gravimetric wave. The effect allowed Enterprise to escape the wave and travel back in time to the source of the wave and destroy it. (TNG comic: "History Lesson")
Montgomery Scott reviewed the logs of the original Enterprise crew, particularly Spock's time travel equations from the Bounty and created another slingshot travel using the Bounty 2 around the Arhennius star to attempt to save James T. Kirk from his apparent death aboard the Enterprise-B. The Enterprise-D followed Scott into the past. (Star Trek novel: Engines of Destiny)
After the crew of the USS Defiant were thrown forwards in time to 2400, they were unable to slingshot around Bajor-B'hava'el as they had no frame of reference on how to do it there. It was later discovered they had travelled to the future by way of the Pah-wraiths' Red wormhole. In this timeline, Jean-Luc Picard's timeship USS Phoenix was designed to withstand the effects of using the slingshot effect to travel twenty-five thousand years into the past. (DS9 novels: The Fall of Terok Nor, The War of the Prophets, Inferno)