Underwater Wireless Sensor Networks (UWSN) are an upcoming technology for various underwater applications, such as environment monitoring and localization of objects. An important use case for underwater object localization is locating the underwater locator beacon (ULB) of a flight recorder, commonly known as a 'black box', after the unfortunate event of an oceanic flight crash. Current technology for finding this black box uses hydrophone-equipped vessels or autonomous underwater vehicles (AUV). To increase the probability of finding the black box using these technologies, a well-estimated position of the flight crash is required which is not always available after oceanic crashes. Also, these technologies need to travel to the crash location which takes time and complicates the search process. To circumvent these problems, this study presents an alternative approach to locating the sinking black box using an UWSN onboard of the aircraft that starts deploying in the ocean after the detection of an oceanic crash event. By registering acoustic ping signals of the ULB, the nodes in the network collaboratively estimate the source location using a Time-Difference of Arrival (TDoA) approach. Underwater nodes are used to extend network coverage to deep-ocean levels and communicate their findings by utilizing wireless acoustic modems. Use of the underwater acoustic medium imposes various challenges such as a slow propagation speed that changes over depth, limited bandwidth and multipath propagation. In this study a set of strategies is introduced to be incorporated in a UWSN that collectively enables localization of the ULB while taking into account the complexities imposed by the underwater acoustic medium. Also a set of communication and scheduling protocols are included that tailor the network hierarchy. To assess the performance of onboard UWSN-based black box localization, a custom Underwater Acoustic Localization Simulator (UWALSim) is built that utilizes BELLHOP for realistic underwater sound propagation modelling. Furthermore, the simulator can detect signal collisions, simulate noise on the acoustic channel and models energy consumption of nodes in the network. Several crash scenarios and variations in self-positioning performance have been used to assess the performance of this approach on localizing the black box. These results show that proper self-positioning is crucial to successfully locate the black box. Also partial deployment of the network in the ocean before the wreckage with the black box starts sinking is highly preferable. When satisfying the requirements in self-positioning performance and partial network deployment, the network is able to locate the black box with an error less than 50 meters for at least 75% of the transmitted ULB pings on a 10-second ping interval. Depending on the scenario, experimental results show that this approach provides accurate black box location estimations after 5-25 minutes since the wreckage with the black box started sinking. Therefore, an onboard ad-hoc UWSN he...