If I've understood correctly, then you probably want something like this:
$firstTag = strpos($content, "[q]");
$lastTag = strrpos($content, "[/q]", 0);
$secondTag = strpos($content, "[q]", $firstTag + strlen("[q]"));
$secondLastTag = strrpos(substr($content, 0, $lastTag), "[/q]");
$content = substr_replace($content, "", $secondTag, $secondLastTag - $secondTag + strlen("[q]") + 1);
Apologies for any errors, I don't have a PHP interpreter handy to test with and it's been about 9 months since I used it so I'm a little rusty.
Effectively what we attempt to do though, is we first find the position in the string of the first opening tag, and we find the position of the last closing tag. Once we have these positions we can use them as offsets to start our searches to find the second opening tag and the second last closing tag. Once we know the positions of these, we then use substr_replace to replace all text in the content string starting from the second opening tag, to the second last closing tag with a blank string.
So to illustrate, if we have:
[q][q]Inner 3[q] Inner 2[/q] Inner 1[/q]Outer[/q]
we find the second [q] tag, the second last [/q] tag, and replace them and everything between them with a blank string and get:
[q]Outer[/q]
Is this what you were looking for?