OK, I'll bite -- here's my breakdown, with the caveat that some of my responses have already been noted by other posters in this thread.
Scenario: Party is proceeding down a wooded path at night with torches. Heavy foliage lines the path, which is 30 feet wide.
OK, first up, a fair number of things we must assume, because they're not mentioned in the scenario:
1) The party is travelling at a Normal pace; as such, they aren't using Stealth (which they can only do if travelling at a Slow pace), and also have no penalties to their passive Wisdom (Perception) scores (which happens if they are travelling at a Fast pace). (BR, pp.63-64)
2) Nobody in the party has darkvision, and the torch is the only source of illumination (there is no moon or other significant light source in the area). As such, within 20 feet of the torch is bright illumination, and a further 20 feet from that is dim illumination (BR, p.50); beyond that is darkness and no PC is able to see. (The goblins have darkvision, so can see as if in dim light out to 60 feet, except in the 40 foot radius area lit by the torch, which counts as bright light for them. SRD, pp. 260,318)
3) The "heavy foliage" (which we will call 'dense foliage', as that matches the text in the Basic Rules) causes the area outside the path to be impenetrable to sight; any creature trying to see within the foliage is effectively blind (i.e.: "suffers from the blinded condition"; BR, p.65). Although darkness can cause an area to be heavily obscured, light does not eliminate obscurement for sources that are not based on a simple absense of light, such as opaque fog or dense foliage (Ibid.), so the party's light source will not allow them to see into the foliage.
4) The path, not the foliage, is 30 feet wide.
Noise off the side of the path up ahead draws their attention.
Either this is by DM fiat (the goblins might have chosen to make noise to draw in the PCs, for example), or the DM has determined that at least one PC has a sufficiently high passive Wisdom (Perception) to beat the goblins' Steath scores while they are hiding on the side of the road.
PC#1 goes up to check it out, is asked to roll Perception and fails.
I'm curious what this Perception check was for. If the party had previously noticed the goblins based on the party's passive Wisdom (Perception) score, then it would seem unnecessary for this PC to have to make another roll. However, it's possible the goblins deliberately made noise (by, say, throwing a rock) in such a way that it wouldn't give away their specific position and/or this PC doesn't have the high passive Perception that successfully noticed the goblins earlier. If either of these situations exist, then the check is valid, though it should be noted that, as the goblins are explicitly in the foliage, there is no change to see them, only to possibly hear them.
Crossbow bolts are fired out of the dark, heavy foliage and strike PC#1.
At this point, initiative has to be rolled, as there is no real support in the combat rules for making an attack outside of the initiative sequence. ("When combat starts, every participant makes a Dexterity check to determine their place in the initiative order.", BR, p.69) If the DM rules that the PCs are surprised, then it doesn't really matter if initiative is rolled before or after the goblins attack, since the PCs can do nothing in the opening round anyway, but there must be an initiative order following the goblin attack.
Let's assume that this was done, and PC#2 has the initiative in the first non-surprise round.
PC#2 asks if she saw the spot from where the bolts were shot. DM asks for Perception roll and there is a success.
This is something of a grey area -- as noted, since the goblins were firing from heavy obscurement, PC#2 is considered blinded when trying to see into that obscurement, and thus cannot succeed on a Wisdom (Perception) roll to find the goblins' position. ("A blinded creature can't see and automatically fails any ability check that requires sight.", BR, p.105) However, in looking for where the bolts came from, this gives the PC an alternative -- perhaps she's noticing the arc of the crossbow bolt that struck PC#1, and looking for rustling in the bushes or other traces that would give away the place where the goblin's bolt exited the bushes and likely the space in the bushes where the goblin was hiding when it fired; I'd allow it, but this isn't a Wisdom (Perception) task -- the character is using information and processing it to reach a conclusion, which to me is an Intellgence (Investigation) check to figure out where the goblin must have been when firing. Note as well that an Intelligence (Investigation) check does not interact with the level of light and/or obscurement, though the DM could rule that even this check would fail automatically if PC#2 were unable to use even dim light to see where the bolt came from (in order to draw a conclusion based on evidence, one must be able to perceive the evidence, after all).
Let's presume that PC#2 was asked to make an Intelligence (Investigation) check instead, and succeeded. However, there's a second question that then must be answered: does this count as taking the Search action, which covers both Wisdom (Perception) and Intelligence (Investigation) checks? I would rule that it does, since the player explicitly asked if she could figure something out, and "[w]hen you take the Search action, you devote your attention to finding something." (BR, p.72) After taking an action to Search, the character cannot then make an attack in the same round.
PC#2 fires her bow into that exact spot, rolling a natural 20.
What was the second roll? The character is firing into the foliage against an unseen target (remember, the character is blinded with respect to targets in heavy obscurement), and thus must roll her attack at disadvantage. If the second roll is not also a '20', then the point is moot, since the attack is not a critical hit.
Unbeknownst to anyone in the party, after firing the crossbow bolts, the two enemies were able to stealth away from that spot (rolled higher on Stealth than any of the party member's Passive Perception).
This would have happened during the surprise round, and the goblins clearly could have moved after attacking, so I'd allow this. Also, if the goblins' Dexterity (Stealth) roll were good enough, nobody in the party would have noticed, so there's no obligation to tell the players something their characters were unable to perceive. Note that all the discussion about what circumstances must exist for the goblins to attempt to Hide are moot, as the rule on Hiding explicitly gives the DM the authority to determine "when circumstances are appropriate for hiding." (BR, p.60) A DM may choose to use prior edition rules to help inform what circumstances are appropriate (or to apply penalties, such as in Saelorn's recollection), but is not required to. Since the goblins are moving and not trying to hide in the exact position they previously attacked from, I wouldn't even consider this an exploitative use of the Hiding rule.
How do you, as DM, rule that Crit?
What crit? This is no more a crit than if the character made an attack roll against an illusory enemy and rolled a '20'; if a PC attacks nothing, it doesn't matter what number comes up on the die.
Hope this helps!
--
Pauper