The game opens in Carousel Boutique at 11:08pm; three bipedal, gravelly-voiced creatures ransack the shop in search of something. They find what they're looking for—a large gemstone—when suddenly a nearby window shatters. The three thieves make a hasty retreat while a dazed and confused Scootaloo sits about a pile of broken glass.
The next day, Twilight Sparkle, having heard about the boutique break-in, rushes onto the scene to find Mayor Mare and a hysterical Rarity. They inform Twilight that the True Blue, a large sapphire Rarity had recently come into possession of, and Rarity's cat Opalescence have been stolen. The mayor also informs Twilight that, because of Ponyville's lack of a proper police force, they've hired an investigative team from Canterlot to take on the case, but they won't be arriving to Ponyville for several days. Twilight is mortified to learn that this investigative team is the same one that had bungled a case in Ponyville before. Afraid of what will happen if they get involved, Twilight offers to take on Rarity's case and solve it before they even arrive. Rarity is unsure of the idea, but wishes Twilight good luck all the same. (Throughout the case, Pinkie Pie appears to give Twilight—and the player—gameplay advice.)
Investigation, part 1
Twilight questions Rarity about the night before, to which Rarity says she was stirred from her sleep by a crash downstairs and found that True Blue and Opal were gone. Twilight asks Rarity about anything else she saw, but Rarity is strangely tight-lipped. During her investigation, Twilight finds tire tracks, strands of white hair, and a star-shaped object outside the boutique's broken window. She deduces that the hairs belong to Opal, and whoever made the tire tracks had swerved to avoid her and crashed through the window, making it an accident. She also finds a torn piece of a Cutie Mark Crusaders cape a short distance away from the boutique; asking Rarity about it reveals that it's Apple Bloom's.
As her investigation leads her toward town hall, Twilight finds Apple Bloom speaking with Sweetie Belle. As Sweetie Belle leaves, Twilight talks to Apple Bloom and finds that she's being dodgy and secretive, especially when she brings up Scootaloo. She interrogates the little filly about the night before; when Apple Bloom says she was nowhere near the boutique, Twilight presents the piece of her cape, which was found near the boutique and Rarity testified as belonging to her. Apple Bloom nearly buckles under the pressure, but Twilight beats her to the punch: she's remaining quiet in order to protect Scootaloo. Feeling guilty, Apple Bloom explains that she and her friends were practicing a routine for Rarity's upcoming birthday the night before. During a break, Apple Bloom and Sweetie Belle hung out by the bridge while Scootaloo was nowhere to be found. Around that time, they heard a crash coming from the boutique. A short while after that, they saw Scootaloo racing away from there. Apple Bloom pleads for Twilight to help Scootaloo, who she knows for sure is innocent.
Twilight returns to Rarity and informs her of what she knows: that Apple Bloom had seen Scootaloo crash through her window, and that Scootaloo had stayed at the boutique for a short while before leaving. Rarity is caught in her deceit and apologizes for not being forthcoming earlier. Her testimony is much the same as before—that a crash had woken her up and she rushed downstairs to find True Blue and Opal gone—but she adds that she saw Scootaloo racing out of the boutique. Twilight believes she knows what happened to Opal; she reasons that the tire tracks outside the window were caused by Scootaloo and that the crash was an accident. After a bit of questioning about how Opal was outside to begin with, she also reaches the conclusion that someone else entered the boutique before Scootaloo arrived, allowing Opal to go outside and creating the conditions leading up to the crash. At this pivotal point in her investigation, Twilight decides it's time to talk to Scootaloo herself.
The daring Scootaloo
On her way to the Cutie Mark Crusaders' clubhouse, Twilight runs into Rainbow Dash. She fills Rainbow in on the situation, but when she asks about Scootaloo, Rainbow immediately clams up. With few options open to her, Twilight proceeds to the Crusaders' clubhouse and finds Sweetie Belle standing guard outside. As Twilight chats her up, they hear a commotion from inside the clubhouse, to which Sweetie Belle refuses Twilight entry. In addition, Sweetie Belle mentions that Scootaloo had recently lost something very important to her, causing her even more grief than there would be otherwise. Twilight presents the star-shaped object she found outside the boutique's broken window, and Sweetie Belle identifies it as half of Scootaloo's lost ribbon, which she'd received from Rainbow Dash and to which Sweetie Belle has the other half. Before returning the restored ribbon to Scootaloo, Twilight chooses to hold onto it for a little longer.
When Twilight returns to Rainbow Dash and shows her the ribbon, Rainbow Dash is caught in her lie. She reveals that she gave the ribbon to Scootaloo a week prior; when she discovered Scootaloo crying out of her inability to fly and her classmates teasing her about it, she gave her the ribbon she'd won in the race that she got her cutie mark during. She also told Scootaloo that if she wanted to get her cutie mark too, she had to "do something really, super daring". Rainbow tells Twilight she didn't say anything in order to preserve her reputation—unfortunately, Apple Bloom was nearby and heard everything. Rainbow leaves, lamenting her ruined image, and Twilight learns from Apple Bloom that Scootaloo is hiding inside the clubhouse. Apple Bloom decides that the only way for Twilight to help Scootaloo is to let them talk, so she makes Twilight an honorary crusader for the day. Together, they return to the clubhouse, and Apple Bloom vouches for Twilight to Sweetie Belle, gaining them entry.
The first confrontation
Scootaloo is naturally upset with Apple Bloom for allowing a "non-Crusader" to enter the clubhouse, but she quickly changes her tune upon learning that Twilight has her ribbon. Using the ribbon as leverage, Twilight confronts Scootaloo about last night.
Scootaloo explains what Twilight already heard from Apple Bloom: that they were practicing a comedy routine for Rarity's birthday. When Twilight presses for more info about how long they were practicing, Scootaloo mentions that they were working on the routine nonstop. However, Twilight had learned from Apple Bloom that they took a break, during which time Apple Bloom and Sweetie Belle were by the bridge and Scootaloo was nowhere to be seen, and considering the tire tracks, the ribbon, and Rarity's testimony, Twilight deduces that Scootaloo was in the area of Carousel Boutique. Scootaloo sweats a little but points out that all Twilight has is circumstantial evidence.
When Scootaloo asks Twilight why she would steal from anypony, Twilight reminds her of Rainbow Dash's words—"do something really, super daring" to get her cutie mark—and there are fewer things more daring for a filly to do than commit theft. Scootaloo gets shaken and insists that the only daring thing she was doing was practicing scooter tricks, specifically a trick similar to one Rainbow Dash performed at the Best Young Flyer Competition. Twilight naturally comes to the conclusion that, while Scootaloo was practicing her trick, Opalescence leapt out in front of her, causing her to swerve into the boutique window.
Defeated, Scootaloo tells Twilight everything aside from what she already figured out herself. After crashing into the boutique, she saw some dark figures that, startled by the crash, ran away. In the scuffle, she heard one of them trip and growl as well as the sound of something getting ripped. After that, she ran from the scene herself. With this new information, Twilight returns Scootaloo's ribbon and heads back to the boutique.
When she enters the boutique, Twilight is shocked to find that Rarity has almost completely cleaned up. All that Twilight finds left of the crime scene is a knocked over stool with a rip in the seat. Rarity offers her services in Twilight's investigation and helps her find easily overlooked evidence, including a bunch of small gems—some of which are strangely shaped.
Outside the boutique, Twilight finds some trampled grass, which she finds odd considering Scootaloo had fled from the boutique across the bridge. Paired with the ripped stool and the fact True Blue was stolen, Twilight begins to get a sense for what's really going on. She leads Rarity south of Ponyville to a rocky, cavernous area lined with gems, and Rarity comes to the frightening realization that they're about to meet with an old foe.
Just outside a large cave, Twilight and Rarity find Opal's signature hair bow, distressing Rarity even more to the whereabouts of her cat.
Rambling Rock Ridge
Sure enough, Twilight and Rarity find themselves at the den of the Diamond Dogs, where one of the guards refuses them entry. When the dog's refusal to stand aside causes Rarity to explode in anger, Rover, one of the dogs' leaders, enters and is shocked to see the white unicorn. He doesn't allow Twilight and Rarity to investigate the caverns either, asking for a search warrant. Reluctantly, Rarity agrees that they can't barge into the dogs' home without legal approval.
Before heading to Town Hall, Twilight attempts to talk to Rover, but he gives her the cold shoulder... and on that shoulder, Twilight discovers strands of white hair—hair that belongs to Opal!
At Town Hall, Twilight and Rarity meet with Mayor Mare and request a search warrant, having suspicions of the Diamond Dogs' involvement in Opal's disappearance and presenting Opal's bow and hair as evidence. When Mayor Mare points out that Twilight isn't an official investigator, Rarity vouches for her, now having complete confidence in her investigative abilities. With that, Mayor Mare assigns Twilight the temporary position of Official Ponyville Investigator and grants her the warrant needed to search the Diamond Dogs' caves.
Twilight and Rarity return to the caves with search warrant in tow, much to Rover's disbelief, and the dogs begrudgingly let them enter.
Investigation, part 2
Twilight's investigation of the Diamond Dogs' caverns yields several interesting clues: furniture carved from gems, a completely vacant room, and a hidden safe (with more strands of Opal's hair next to it). Despite the dogs' outright refusal to cooperate (and their puzzling knowledge of Equestrian law), Twilight soon discovers that the safe is empty. When Twilight runs out of places to check, Rarity suggests they investigate where she first found True Blue.
At the dig site where Rarity found True Blue, Twilight finds claw marks near a large hole in the ground and an X carved into a nearby rock, indicating someone was trying to find something but didn't. With Rarity's help, Twilight also finds an old key carved from a gem, similar to the one used to lock the Diamond Dogs' safe. With everything she needs to see this mystery through the end, Twilight goes to have one last talk with the Diamond Dogs.
The second confrontation
The Diamond Dogs deny any involvement in the theft of True Blue, but Twilight convinces them to try and establish their innocence anyway.
Fido, the largest of the Diamond Dog leaders, states there's no evidence linking them to the crime scene and argues that another pony could've stolen the gem. Twilight argues back that ponies don't leave claw marks, such as the rip in Rarity's stool. Fido starts to sweat, but Spot, the shortest Diamond Dog, attempts to shift blame onto Twilight's dragon friend Spike, who also has claws and likes gems. However, Twilight is quick to point out the gems left behind at the crime scene, which the thief made no effort in stealing. Why would the thief steal the True Blue and nothing else? Now Spot starts to sweat as well.
Fido bounces back and reminds Twilight of the true suspect Scootaloo and brings up that there's nothing to show how they could've entered the boutique with the front door locked. Twilight wonders why he would bring that up, but then she remembers the oddly shaped gems she found in the boutique: the thief (or thieves) used the gems to pick the door lock. Just like the Diamond Dogs' carved furniture and safe keys, they'd carved a lockpick to enter the boutique and dropped it as they fled. The only way they could've known Rarity kept her door locked and that Scootaloo was there was if they were there themselves.
Before Fido buckles under the pressure, Rover interjects and reminds Twilight that they have no motive.
The final confrontation
Rover argues that the Diamond Dogs have so many gems lying around, a gem like the True Blue means nothing to them and they have no attachment to it. However, Twilight recalls the empty safe and reaches the (presently confusing) conclusion that the Dogs were also recent victims of theft. Rover nearly breaks but quickly states that the safe is brand new. Twilight finds this to be false as well, indicated by the presence of an old safe key. Rover asks Twilight for evidence that her alleged thief even exists, and she presents the empty cave room—the only empty room in the whole cave. She deduces that a dog used to live in it and recently vacated.
Twilight puts together what she thinks really happened: First, the thief stole the original safe key and made off with the True Blue. The Diamond Dogs pursued and caught him but were unable to recover the True Blue because Rarity had discovered it by that time. They then hatched a plan to retrieve it from Rarity, but their plans were ruined when Scootaloo came crashing in. In their hasty escape, they dropped the lockpick.
Twilight thinks she's won, but Rover still denies everything, stating they did get the stolen gem back. Twilight catches Rover in yet another lie and presents the rock with the X carved into it. She reasons that the thief buried the True Blue as he made off with it and etched an X into a nearby rock to remind himself of his hiding spot. By the time they returned to the hiding spot, Rarity had already found it and walked away. Twilight also reasons that they staged an elaborate heist rather than take the True Blue back by force because they didn't want to have to deal with "Miss Rarity".
Finally and utterly defeated, Rover breaks down and confesses to stealing the True Blue from Carousel Boutique. The dogs show Twilight and Rarity to the True Blue, which Opal is sleeping next to. Rover demands they take Opal and the True Blue and leave, but Rarity lets the dogs keep True Blue since it was theirs to begin with. She even forgives them for ransacking the boutique since "it needed a good remodeling anyway". With that, Rarity commends Twilight for a job well done, and they take their leave of the cave.
Back at the boutique, for the crime of stealing the True Blue, Mayor Mare finds Scootaloo not guilty, much to her fellow Crusaders' delight. In addition, for Twilight's exemplary investigative skills, the mayor makes her position as Official Ponyville Investigator permanent.
With everything else settled, Rarity confronts Scootaloo about her broken window. Scootaloo fears severe punishment for her actions, but instead of scolding her, Rarity hugs her and apologizes for not doing enough to convince her to trust them. Scootaloo apologizes for not coming forward with the truth from the beginning, and Rarity accepts. As the Crusaders leave to go play, Rarity thanks Twilight for everything she's done today.
Some time later, much merriment is had at Rarity's birthday party. During the festivities, Twilight writes to Princess Celestia about her latest lessons about friendship: honesty is the best policy, and a little kindness and generosity goes a long way, even toward enemies. As Twilight closes out her letter, the Cutie Mark Crusaders put on their comedy routine; sadly, they don't receive their cutie marks in stand-up comedy.
In a post-credits scene, Twilight wonders whatever happened to the investigative team from Canterlot, and they are shown to have somehow gotten lost on their way to Ponyville (even though the train goes straight there from Canterlot). Twilight is excited about the cases she might get to solve in the future and vows to do her best as an official investigator.
The voice of an unseen pony declares "Watch in awe!" as ponies cheer and fireworks explode...