Criticism of time–manner–place
I know this rule is widely taught, but it is utter nonsense. Let's examine the examples given on Wikipedia.
Ich fahre heutetime mit dem Automanner nach Münchenplace.
I'm travelling to Munichplace by carmanner todaytime.
Now isn't this neat? German word order is the inverse of the English one. Typologists start salivating, as this reversal pairs nicely with the one observed for verbs.
weil das Ergebnis respektiert3 werden2 muß1
because the result must1 be2 respected3
Unfortunately, it is fiction.
nach München is a direction, not a place, and German grammar distinguishes sharply between the two.
nach München is not a modifier (an adjunct in linguistic parlance; Angabe in German), but an argument (complement, Ergänzung). Modifiers and arguments behave differently.
A simple but famous example to show the difference between places and directions.
Sie hat im Zimmer getanzt.
Sie ist ins Zimmer getanzt.
A direction such as ins Zimmer forces a locomotory meaning on the verb tanzen, which in turn changes the auxiliary in the past from haben to sein.
Directional complements such as nach München, ins Zimmer prefer to appear on the far right of the sentence, as do locational complements.
weil er sich in letzter Zeit häufiger dienstlich in München aufgehalten hat
Now let's move on to your sentence.
Das Mädchen hat gestern in Berlin gut gesungen.
The important thing to note is that gestern in Berlin (preferably in that order, although the reverse is possible) is a modifier that situates the entire event the sentence is talking about. Modifiers of this kind tend to appear relatively far to the left. Note that gestern in Berlin can appear in first position; this indicates that time and place can fuse together in order to situate an event.
Gestern in Berlin hat sie wieder wunderbar gesungen.
Adjuncts such as gut, wunderbar and zusammen in the following sentence do not serve to situate an event. Their role is to modify a verb, and they consequently occur relatively far to the right, where the verb is located — but still in front of directional complements.
Wir sind am Wochenende zusammen ans Meer gefahren.
The difference between a place used as a situating adjunct and as a verbal adjunct can be observed in sentences such as the following:
als wir damals in Riminisituating zusammen im Meerverbal adjunct geschwommen sind
An overview of the complexities involved can be gleaned from the IDS grammar; note the distinction between kontextspezifizierende Satzadverbialia and Verbgruppenadverbialia.
What to learn instead
1. Certain complements appear as far to the right as possible. This includes adverbial and prepositional complements.
während seine Frau immer noch gemütlich im Bett liegt
wenn am Wochenende wieder eine Horde Fußballfans durch die Stadt zieht
ob der Wert solcher Veranstaltungen wirklich nur im Erfahrungsaustausch besteht
2. Temporal and local adjuncts that serve to orient the listener appear far to the left. The order they appear in can vary.
Ob in der Stadt am Wochenende wieder so viel los ist?
Ob am Wochenende in der Stadt wieder so viel los ist?
3. A sentence can have multiple temporal and local adjuncts, which are interpreted differently: Those to the left situate the entire event, those to the right modify the verb.
als wir in Rimini tatsächlich einmal zusammen im Meer schwammen
weil wir damals leider fast nie am Wochenende weggefahren sind